Skip to content

Commit

Permalink
Show the toolbar as fixed when on tablet breakpoint even if using pop…
Browse files Browse the repository at this point in the history
…over setting
  • Loading branch information
jeryj committed Aug 10, 2023
1 parent f985380 commit 233694d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
import { useDispatch, useSelect } from '@wordpress/data';
import { useShortcut } from '@wordpress/keyboard-shortcuts';
import { getScrollContainer } from '@wordpress/dom';
import { useViewportMatch } from '@wordpress/compose';

/**
* Internal dependencies
Expand Down Expand Up @@ -70,6 +71,7 @@ function SelectedBlockTools( {
},
[ clientId ]
);
const isLargeViewport = useViewportMatch( 'medium' );
const isToolbarForced = useRef( false );
const { shouldShowContextualToolbar, canFocusHiddenToolbar } =
useShouldContextualToolbarShow();
Expand Down Expand Up @@ -112,10 +114,11 @@ function SelectedBlockTools( {
clientId,
} );

if ( isFixed ) {
// We need to show the toolbar as fixed when we're on the tablet breakpoint.
if ( isFixed || ! isLargeViewport ) {
return (
<BlockContextualToolbar
isFixed={ isFixed }
isFixed={ true }
__experimentalInitialIndex={
initialToolbarItemIndexRef.current
}
Expand Down

0 comments on commit 233694d

Please sign in to comment.