Skip to content

Commit

Permalink
Fix select mode in top toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Sep 28, 2023
1 parent a88c414 commit ea7fd74
Showing 1 changed file with 35 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,41 @@ function SelectedBlockTools( {

if ( isFixed || ! isLargeViewport ) {
return (
<BlockContextualToolbar
// Needs to be passed as `true` so it can be set fixed smaller screens as well
isFixed={ true }
__experimentalInitialIndex={
initialToolbarItemIndexRef.current
}
__experimentalOnIndexChange={ ( index ) => {
initialToolbarItemIndexRef.current = index;
} }
// Resets the index whenever the active block changes so
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
key={ clientId }
/>
<>
<BlockContextualToolbar
// Needs to be passed as `true` so it can be set fixed smaller screens as well
isFixed={ true }
__experimentalInitialIndex={
initialToolbarItemIndexRef.current
}
__experimentalOnIndexChange={ ( index ) => {
initialToolbarItemIndexRef.current = index;
} }
// Resets the index whenever the active block changes so
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
key={ clientId }
/>
{ shouldShowBreadcrumb && (
<BlockPopover
clientId={ capturingClientId || clientId }
bottomClientId={ lastClientId }
className={ classnames(
'block-editor-block-list__block-popover',
{
'is-insertion-point-visible':
isInsertionPointVisible,
}
) }
resize={ false }
{ ...popoverProps }
>
<BlockSelectionButton
clientId={ clientId }
rootClientId={ rootClientId }
/>
</BlockPopover>
) }
</>
);
}

Expand Down

0 comments on commit ea7fd74

Please sign in to comment.