From dcd311ae4979bb8f03f0eefeda1e13774245446a Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 21 Mar 2022 12:22:32 +0400 Subject: [PATCH] Don't render toolbar icon if user can't interact --- .../src/components/block-lock/style.scss | 4 --- .../src/components/block-lock/toolbar.js | 29 ++++++++----------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/packages/block-editor/src/components/block-lock/style.scss b/packages/block-editor/src/components/block-lock/style.scss index 79da8e4b89e35c..42da30f0634f12 100644 --- a/packages/block-editor/src/components/block-lock/style.scss +++ b/packages/block-editor/src/components/block-lock/style.scss @@ -64,8 +64,4 @@ right: $grid-unit-15 !important; } } - - .components-button[aria-disabled="true"] { - opacity: 1; - } } diff --git a/packages/block-editor/src/components/block-lock/toolbar.js b/packages/block-editor/src/components/block-lock/toolbar.js index 5462a02c3fe1d6..1a01498367b623 100644 --- a/packages/block-editor/src/components/block-lock/toolbar.js +++ b/packages/block-editor/src/components/block-lock/toolbar.js @@ -36,35 +36,30 @@ export default function BlockLockToolbar( { clientId } ) { false ); - if ( canMove && canRemove ) { + if ( ! canLockBlocks ) { return null; } - const label = canLockBlocks - ? sprintf( - /* translators: %s: block name */ - __( 'Unlock %s' ), - blockInformation.title - ) - : sprintf( - /* translators: %s: block name */ - __( 'Locked %s' ), - blockInformation.title - ); + if ( canMove && canRemove ) { + return null; + } return ( <> - { isModalOpen && canLockBlocks ? ( + { isModalOpen && ( - ) : null } + ) } ); }