Skip to content

GAUD-7147: Flag removal of old tabs structure#6948

Open
margaree wants to merge 5 commits intomainfrom
mpeacocke/flag-tabs-old-structure-removal
Open

GAUD-7147: Flag removal of old tabs structure#6948
margaree wants to merge 5 commits intomainfrom
mpeacocke/flag-tabs-old-structure-removal

Conversation

@margaree
Copy link
Copy Markdown
Contributor

@margaree margaree commented May 7, 2026

GAUD-7147

Generally in tabs.js we could rely on setting _defaultSlotBehavior based on the flag, and then if the flag was false then it would never use the old behaviour. There are a couple things I hid behind the flag as well to ensure we can clean them up.

TODO:

  • create flag
  • wait for remaining PRs to merge before this

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-6948/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

expect(el.querySelector('#all-panel').getAttribute('aria-labelledby')).to.equal('all');
});

describe('flag off', () => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept a few tests for the case where the flag is off but the new structure should still work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably easier to review with Hide Whitespace


describe('events', () => {

// remove after d2l-tab/d2l-tab-panel backport
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were moved to a separate section.

*/
text: { type: String }
text: { type: String },
_selected: { type: Boolean, attribute: '_selected', reflect: true }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to an "internal" property (it's used in the css) since we wanted selection set on the tab and not the panel. Let me know if alternative ideas for this.

Comment thread components/tabs/tabs.js
* Remove this._defaultSlotBehavior and related code with GAUD-8299-core-tabs-use-new-structure flag clean up
* NOTE: remove the TRUE case of _defaultSlotBehavior
*/
this._defaultSlotBehavior = !this.#newTabsPanelStructure;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_defaultSlotBehavior = use the default slot (old) rather than the tab and panels slots ("new"); we don't want to enable it at all if the flag is on.

Comment thread components/tabs/tabs.js
role="tablist"
style="${styleMap(tabsContainerListStyles)}">
${repeat(this._tabInfos, (tabInfo) => tabInfo.id, (tabInfo) => html`
${!this.#newTabsPanelStructure ? repeat(this._tabInfos, (tabInfo) => tabInfo.id, (tabInfo) => html`
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gated some things with the flag to ensure clean-up-ability

Comment thread components/tabs/tabs.js
}

// remove after d2l-tab/d2l-tab-panel backport
// remove with GAUD-8299-core-tabs-use-new-structure flag clean up
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the comments for easier flag search clean up

Comment thread components/tabs/tabs.js
Comment on lines +1065 to +1072
if (this._state === 'shown' && tabs.length < 2) {
this.#hideTabsList();
} else if (this._state === 'hidden' && tabs.length > 1) {
this.#showTabsList();
} else if (this._state === 'shown' && tabs.length > 1) {
// check if there are hidden tabs and tab list container should actually be hidden
this.#handleTabHiddenChange();
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as before, just renames panels to tabs.

Made the change from the comment above the function behind the flag in case there's an issue.

Can pull this into a separate PR if that would be preferred.

Comment thread components/tabs/tabs.js
const selectedPanel = this._getPanel(selectedTab.id);
if (selectedPanel) selectedPanel.selected = true;
if (selectedPanel) {
if (this.#newTabsPanelStructure) selectedPanel._selected = true;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switches to use panel's "internal" _selected instead

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@margaree margaree marked this pull request as ready for review May 7, 2026 19:33
@margaree margaree requested a review from a team as a code owner May 7, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant