Skip to content

Commit

Permalink
Components: Fix Toolbar arrow key navigation in RTL contexts (#24043)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegohaz authored Jul 20, 2020
1 parent 1a3739b commit b958ae2
Showing 1 changed file with 6 additions and 1 deletion.
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';

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

0 comments on commit b958ae2

Please sign in to comment.