Skip to content

Commit

Permalink
Tabs: override tablist's tabindex only when necessary (WordPress#66209)
Browse files Browse the repository at this point in the history
Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Oct 17, 2024
1 parent 4f405ac commit b8cd03d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit b8cd03d

Please sign in to comment.