-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(Tabs): improve screen reader support #6989
fix(Tabs): improve screen reader support #6989
Conversation
82e2f98
to
07a3aad
Compare
Deploy preview for carbon-elements ready! Built with commit 82e2f98 |
Deploy preview for carbon-components-react ready! Built with commit 82e2f98 https://deploy-preview-6989--carbon-components-react.netlify.app |
Deploy preview for carbon-elements ready! Built with commit bb28519 |
Deploy preview for carbon-components-react ready! Built without sensitive environment variables with commit bb28519 https://deploy-preview-6989--carbon-components-react.netlify.app |
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.
@emyarod looks good!
Still not working in screen readers. Still need to:
Also, I looked more closely at the
|
3a23a97
to
0b7d5fd
Compare
I updated the PR with your suggestions @carmacleod . The only exception is the focus order change for the tabpanels, but I think we can make that change separately after discussing the pattern and user expectations more |
This is way better! The browsers and screen readers now recognize this as a tablist with tabs! 🎉
I will test more later. |
ee3435a
to
e428f27
Compare
that tab was rendering some example custom content so I've added the role attribute to that example |
e428f27
to
cd15576
Compare
It would be better if the component didn't leave the ARIA markup up to the author? Would it be difficult to code it so that the custom content is added as a child of the tabpanel div? So in the initial state, the tabpanel div is there, but simply empty? It can be hidden until it's selected. (Is the visually-hidden necessary?) So, instead of:
Would it be possible to mark the tabpanel div up like this, and maybe use the div.some-content to add the custom content?
(Note that we still need to discuss adding tabpanels to the tab order, so the above doesn't add |
it isn't left up to the author by default but if they require a custom tab wrapper, it is available to them as an option. what you proposed is a possibility, but I think that eliminates existing functionality for the consumer which would be a breaking change. we also have to evaluate whether or not we should restrict tab panel content to a |
Maybe it can be written in such a way the change is completely transparent to the consumer?
The tabpanel itself is already a div, so maybe just add the content provided by the consumer/author as a child of the tabpanel? Edit: Actually, I think there is something that I am completely not understanding here. The Tabs in this Tabs component are always rendered when selected (i.e. arrow to Tab, see content), so I'm not sure what the |
Finally had a chance to test the scrolling arrow buttons, and I think that having them in the tab order and visible to screen readers is definitely problematic. Please note the following points in @aagonzales's keyboard navigation design:
Together with the diagrams, and given that she was answering my scroll arrow button questions from #4758 (comment), I interpreted the first 2 design points above to mean that the scroll arrow buttons would not be in the tab order, and they would be hidden from screen readers. We can do that by adding Note also that right-click currently activates the scroll buttons, which feels really odd. There's also a strange state that a keyboard user can get into where the tablist has the focus. We should make sure that doesn't happen. (maybe just taking the scrolling arrow buttons out of the tab order will fix that? I can test again afterwards). Edit: Just realized I still need to test and think about mobile, and what happens in mobile screen readers if the scroll arrow buttons are taken out of the tab order. Argh. Are you allowed to conditionally take the scroll buttons out of the tab order on desktop and leave them in for mobile (if necessary)? Just asking, for now. |
the regarding the suggested changes, the scroll buttons are no longer tab focusable and also marked with
just a side note, this is automatically applied to our icons by default when they are generated
scroll buttons should now only activate with left mouse button
I haven't been able to replicate that. Can you provide a list of steps to reliably enter this state?
This would require us to differentiate between mobile and desktop clients, which is possible but it would be very hacky and inconsistent I believe for the Home and End key enhancements, I think we can create a separate ticket for that to curb the scope creep that's occurring to this ticket |
cd15576
to
9921286
Compare
This seems better, but the "strange state" is even more pronounced now, so I can't quite test fully yet:
Here's how to replicate (saw this in FF and Chrome on Windows - didn't try it anywhere else):
Somehow, the Sorry about the scope creep. Some of it was because I can't test the screen readers until the markup reaches the point where screen readers recognize the component. :) I've opened separate issues for: Still need to open one for further discussion of renderContent api. |
9921286
to
fbdbb1c
Compare
fbdbb1c
to
1b2a245
Compare
Closes #6984
This PR updates the
role
attribute on the tab anchor and moves the aria attributes from the parent list item element to the anchor as well. The anchor is also updated to be a button now to prevent things like "Open link in new window" or "Copy link address" from appearing in the context menuChangelog
Changed
renderAnchor
(to be replaced withrenderButton
, unless we have a better name in mind)Removed
Testing / Reviewing
Ensure the updated tabs match the existing tabs in behavior and appearance and confirm the updated markup matches the expected markup from the referenced issue