Skip to content
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

scale-tab-panel tabindex #2209

Closed
nikolab-pn opened this issue Nov 16, 2023 · 5 comments
Closed

scale-tab-panel tabindex #2209

nikolab-pn opened this issue Nov 16, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@nikolab-pn
Copy link

Scale Version
@telekom/scale-components 3.0.0-beta.143

Framework and version
@telekom/scale-components-react 3.0.0-beta.143

Current Behavior
scale-tab-panel has tabindex="0", if tabindex is set to -1, then content inside pannel is not reachable with tab key

Expected Behavior
scale-tab-panel should not have tabindex

Code Reproduction
CodeSandbox

@nikolab-pn nikolab-pn added the bug Something isn't working label Nov 16, 2023
@felix-ico
Copy link
Collaborator

hi @nikolab-pn, the tab-index is hard coded to 0 in scale-tab-panel. Apparently this was part of an accessibilty fix 8ef111c , i assume it has to do with users being able to reach (text) content within the tab-panel

@nikolab-pn
Copy link
Author

Hi @felix-ico, we received this issue from accessibility review. Maybe it can stay as is with an option to disable it. As per WAI it is OK to have tabIndex 0 if there is no focusable elements in tabpanel but it's not needed if there are.

Under Accessibility Features, 2nd bulletpoint.
https://www.w3.org/WAI/ARIA/apg/patterns/tabs/examples/tabs-manual/

@felix-ico
Copy link
Collaborator

@nikolab-pn i added a PR here #2215, i had to add a prop tabbablePanel (don't really like that name) that sets tabindex="0"if true, and completely removes tabindex if set to false. Setting tabindex to -1 on the panel made it so that the button would not be focusable at all.

is OK to have tabIndex 0 if there is no focusable elements in tabpanel but it's not needed if there are.

However, just after opening the PR I had another look at the link you posted and i'm not 100% sure this is actually what they are saying there:

it is recommended that all tabpanel elements in a tab set are focusable if there are any panels in the set that contain content where the first element in the panel is not focusable.

So the way i understand it, this new tabbablePanel prop should be set to false only if all panels first child element is a focusable element.

@nikolab-pn
Copy link
Author

Good catch. We have both cases so I will need to be carefull.

@felix-ico
Copy link
Collaborator

felix-ico commented Nov 24, 2023

this has just been merged and will be available with beta.144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants