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

Components: Fix Toolbar arrow key navigation in RTL contexts #24043

Merged
merged 1 commit into from
Jul 20, 2020
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
7 changes: 6 additions & 1 deletion packages/components/src/toolbar/toolbar-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ import { forwardRef } from '@wordpress/element';
* Internal dependencies
*/
import ToolbarContext from '../toolbar-context';
import { getRTL } from '../utils/rtl';
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, we'd drop this in favor of { isRTL } from '@wordpress/i18n' but this could be separate as this is already used.


function ToolbarContainer( { accessibilityLabel, ...props }, ref ) {
// https://reakit.io/docs/basic-concepts/#state-hooks
// Passing baseId for server side rendering (which includes snapshots)
// If an id prop is passed to Toolbar, toolbar items will use it as a base for their ids
const toolbarState = useToolbarState( { loop: true, baseId: props.id } );
const toolbarState = useToolbarState( {
loop: true,
baseId: props.id,
rtl: getRTL(),
} );

return (
// This will provide state for `ToolbarButton`'s
Expand Down