-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Refactor S2 tabs to fix accessibility issues #7600
Open
devongovett
wants to merge
19
commits into
main
Choose a base branch
from
tabs-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e205d8d
wip: Refactor S2 tabs to fix accessibility issues
devongovett 08ab651
yarn
devongovett 1dbf1b8
Merge branch 'main' into tabs-refactor
snowystinger 969e5d7
review comments
snowystinger e44da4a
fix lint
snowystinger b56a7a3
Merge branch 'main' into tabs-refactor
snowystinger 23c4960
fix orientation case
snowystinger 4c1bfa9
Merge branch 'tabs-refactor' of github.com:adobe/react-spectrum into …
snowystinger e803d9f
Fix orientation case not updating overflow
snowystinger 783c241
Merge branch 'main' into tabs-refactor
snowystinger 92cb122
Merge branch 'main' into tabs-refactor
snowystinger 86a98e3
Add required labelling and other review comments
snowystinger ce5ac32
fix a few more announcements
snowystinger 1a64592
fix lint
snowystinger d760020
fix chromatic
snowystinger 143f0ce
remove translations
snowystinger 8d848d9
fix announcements
snowystinger 5b8d8a0
fix lint
snowystinger 4340518
Merge branch 'main' into tabs-refactor
snowystinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opinion, I changed S2 Tabs to require an aria-label or aria-labelledby following #7600 (comment)
I needed to move it to the Tabs component so that I could propagate it to the TabList OR the TabMenu. It's also important that the element is always in the DOM and the TabList isn't when we're collapsed.
Should I push some form of this change down to RAC Tabs? If so, what? I could remove the label props, but then extending them is weird.
We currently accept both label props on both Tabs and TabList, though putting it on RAC Tabs actually won't do anything for accessibility.
Do I remove them all (label/described/etc) from the S2 TabList?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO I think it is fine to have the aria-label/labelledby props at the top level for S2 Tabs even if it differs from RAC Tabs. As for whether or not to change RAC Tabs, I guess that is dependent on whether we want to make re-creating this kind of collapsable behavior easier for end users (though they can implement a context shuttling down the aria-label/labelledby to their TabList/Tabpicker relatively easily I suppose).
Not sure I follow this, looks like you omit those label props from S2 TabList? Unless you are referencing RAC Tabs but RAC Tabs doesn't take the label props in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referring to RAC Tabs, looks like it takes label props?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh hm, well at the moment providing an
aria-label
to Tabs doesn't apply it anywhere I believe becausereact-spectrum/packages/react-aria-components/src/Tabs.tsx
Line 167 in 7b7b461
labelable
, which on a 2nd read is what I guess you were saying withthough putting it on RAC Tabs actually won't do anything for accessibility.
...Actually looks like a bunch of our components (ComboBox, etc) that have a outer div wrapper have this mismatch, not sure we actually want to allow the container to have those label props...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah looks like they propagate those label props to the inner input/etc so might be good to do the same for RAC Tabs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we remove the labelable props on the TabList then? that'd technically be breaking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ComboBox/TextField, it looks like the
aria-label
provided on theInput
wins over the one placed on the ComboBox/TextField. We could follow that behavior instead of removing the labelable props from TabList for consistencyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, the issue with that is that I can't target the label over in the tabpanel