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

[core] fix(Tabs): use tabIndex of -1 for non-active tabs #4951

Merged
merged 1 commit into from
Oct 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/components/tabs/tabTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class TabTitle extends AbstractPureComponent2<TabTitleProps> {
id={generateTabTitleId(parentId, id)}
onClick={disabled ? undefined : this.handleClick}
role="tab"
tabIndex={disabled ? undefined : 0}
tabIndex={disabled ? undefined : selected ? 0 : -1}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tangentially related to this PR but I think if we set tabIndex={0} when disabled here the element may not be visible to screen-readers

not 100% sure on that/not set up right now with a good way to test but it's been a working assumption of mine for awhile that disabled elements should remain in the tab order

if so it would possibly would be more appropriate to add to the wrapping div here but again I'm not sure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this code will never set tabIndex={0} when it's disabled, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, ^ was my understanding as well so i thought this was ok

>
{title}
{children}
Expand Down