Skip to content

Commit

Permalink
Tabs and TabPanel: Fix arrow key navigation in RTL (WordPress#66201)
Browse files Browse the repository at this point in the history
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
  • Loading branch information
4 people authored and karthick-murugan committed Nov 13, 2024
1 parent d974857 commit 1be96f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- `Tabs`: fix indicator animation ([#66198](https://github.com/WordPress/gutenberg/pull/66198)).
- `ColorPalette`: prevent overflow of custom color button background ([#66152](https://github.com/WordPress/gutenberg/pull/66152)).
- `Tabs` and `TabPanel`: Fix arrow key navigation in RTL ([#66201](https://github.com/WordPress/gutenberg/pull/66201)).

### Enhancements

Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/tab-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useCallback,
} from '@wordpress/element';
import { useInstanceId, usePrevious } from '@wordpress/compose';
import { isRTL } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -120,6 +121,7 @@ const UnforwardedTabPanel = (
orientation,
selectOnMove,
defaultSelectedId: prependInstanceId( initialTabName ),
rtl: isRTL(),
} );

const selectedTabName = extractTabName(
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
useMemo,
useRef,
} from '@wordpress/element';
import { isRTL } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -45,6 +46,7 @@ function Tabs( {
onSelect?.( strippedDownId );
},
selectedId: selectedTabId && `${ instanceId }-${ selectedTabId }`,
rtl: isRTL(),
} );

const isControlled = selectedTabId !== undefined;
Expand Down

0 comments on commit 1be96f4

Please sign in to comment.