-
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
base: main
Are you sure you want to change the base?
Changes from 15 commits
e205d8d
08ab651
1dbf1b8
969e5d7
e44da4a
b56a7a3
23c4960
4c1bfa9
e803d9f
783c241
92cb122
86a98e3
ce5ac32
1a64592
d760020
143f0ce
8d848d9
5b8d8a0
4340518
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
"table.sortAscending": "Sort Ascending", | ||
"table.sortDescending": "Sort Descending", | ||
"table.resizeColumn": "Resize column", | ||
"tabs.selectorLabel": "Tab selector", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need these additional strings? We didn't have these in v3. Is the label provided by the app enough? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. linking to discussion about this #7600 (comment) |
||
"tag.showAllButtonLabel": "Show all ({tagCount, number})", | ||
"tag.hideButtonLabel": "Show less", | ||
"tag.actions": "Actions", | ||
|
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