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

Tabs: override tablist's tabindex only when necessary #66209

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- `ColorPalette`: prevent overflow of custom color button background ([#66152](https://github.com/WordPress/gutenberg/pull/66152)).
- `RadioGroup`: Fix arrow key navigation in RTL ([#66202](https://github.com/WordPress/gutenberg/pull/66202)).
- `Tabs` and `TabPanel`: Fix arrow key navigation in RTL ([#66201](https://github.com/WordPress/gutenberg/pull/66201)).
- `Tabs`: override tablist's tabindex only when necessary ([#66209](https://github.com/WordPress/gutenberg/pull/66209)).

### Enhancements

Expand Down
9 changes: 8 additions & 1 deletion packages/components/src/tabs/tablist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,15 @@ export const TabList = forwardRef<
<StyledTabList
ref={ refs }
store={ store }
render={ ( props ) => (
<div
{ ...props }
// Fallback to -1 to prevent browsers from making the tablist
// tabbable when it is a scrolling container.
tabIndex={ props.tabIndex ?? -1 }
/>
) }
onBlur={ onBlur }
tabIndex={ -1 }
data-select-on-move={ selectOnMove ? 'true' : 'false' }
{ ...otherProps }
className={ clsx(
Expand Down
Loading