Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📖 Description
This is a draft version of a proposed rework of the
tabs
component with a primary goal of making it easier to extend.The current api currently works based on the order of child elements in the DOM ie. the first child
tab
component is associated with the firsttab-panel
child, the second with the second, etc... The component assigns children id's if they don't already have them and then populates aria "controls" and "labelledby" attributes accordingly. So, tab/tab-panel linkage and keyboarding is via arrow keys is based on DOM order. Not very flexible.This change proposes:
customTabOrder
public property which is astring[]
of tab id's which defines the order of active tabs.tabOrder
property so the order of tabs can be easily managed without re-ordering the DOM (ie. should play well with frameworks).activeid
is the "source of truth" for active tabA simple example of a custom tab order looks like this in markup:
And renders the tabs in the specified order rather than dom order:
This is a major rewrite, but it should (hopefully) not break folks that haven't extended/overridden the component. There is a minor template change to add a
ref
.🎫 Issues
#6445
👩💻 Reviewer Notes
Work in progress
📑 Test Plan
Need to add
✅ Checklist
General
$ yarn change
Component-specific
⏭ Next Steps