Skip to content

Commit

Permalink
Block Switcher: Use consistent labels (#58240)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored Jan 25, 2024
1 parent add3878 commit 61f7d05
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/block-editor/src/components/block-switcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,20 @@ export const BlockSwitcher = ( { clientIds } ) => {
if ( invalidBlocks ) {
return null;
}

const isSingleBlock = clientIds.length === 1;
const blockSwitcherLabel = isSingleBlock
? blockTitle
: __( 'Multiple blocks selected' );
const hideDropdown = ! hasBlockStyles && ! canRemove;

if ( hideDropdown ) {
return (
<ToolbarGroup>
<ToolbarButton
disabled
className="block-editor-block-switcher__no-switcher-icon"
title={ blockTitle }
title={ blockSwitcherLabel }
icon={
<>
<BlockIcon icon={ icon } showColors />
Expand All @@ -240,10 +246,7 @@ export const BlockSwitcher = ( { clientIds } ) => {
</ToolbarGroup>
);
}
const isSingleBlock = clientIds.length === 1;
const blockSwitcherLabel = isSingleBlock
? blockTitle
: __( 'Multiple blocks selected' );

const blockSwitcherDescription = isSingleBlock
? __( 'Change block type or style' )
: sprintf(
Expand Down

0 comments on commit 61f7d05

Please sign in to comment.