From bd7b43301f273940d8886312d229597dd296f2d0 Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Tue, 27 Aug 2024 11:49:18 -0500 Subject: [PATCH] Only show title in content only toolbar if has title value --- packages/block-library/src/image/image.js | 91 ++++++++++++----------- 1 file changed, 48 insertions(+), 43 deletions(-) diff --git a/packages/block-library/src/image/image.js b/packages/block-library/src/image/image.js index 646299bb7e089..034376cba8726 100644 --- a/packages/block-library/src/image/image.js +++ b/packages/block-library/src/image/image.js @@ -676,51 +676,56 @@ export default function Image( { /> ) } /> - ( - { - if ( ! isOpen && event.keyCode === DOWN ) { - event.preventDefault(); - onToggle(); - } - } } - > - { __( 'Title' ) } - - ) } - renderContent={ () => ( - { lockTitleControlsMessage } - ) : ( - <> - { __( - 'Describe the role of this image on the page.' - ) } - + { title && ( + ( + { + if ( + ! isOpen && + event.keyCode === DOWN + ) { + event.preventDefault(); + onToggle(); + } + } } + > + { __( 'Title' ) } + + ) } + renderContent={ () => ( + { lockTitleControlsMessage } + ) : ( + <> { __( - '(Note: many devices and browsers do not display this text.)' + 'Describe the role of this image on the page.' ) } - - - ) - } - /> - ) } - /> + + { __( + '(Note: many devices and browsers do not display this text.)' + ) } + + + ) + } + /> + ) } + /> + ) } ) }