From 0d44880ffadd9a1cd657a6c896a9920d8b409cd0 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 12 Nov 2024 15:31:39 +1100 Subject: [PATCH] Remove aria label if area isn't clickable --- .../edit-site/src/components/style-book/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/edit-site/src/components/style-book/index.js b/packages/edit-site/src/components/style-book/index.js index 99881cc762797..ed24e46743d62 100644 --- a/packages/edit-site/src/components/style-book/index.js +++ b/packages/edit-site/src/components/style-book/index.js @@ -531,11 +531,15 @@ const Example = ( { id, title, blocks, isSelected, onClick, content } ) => { 'is-disabled-example': !! disabledProps?.disabled, } ) } id={ id } - aria-label={ sprintf( - // translators: %s: Title of a block, e.g. Heading. - __( 'Open %s styles in Styles panel' ), - title - ) } + aria-label={ + !! onClick + ? sprintf( + // translators: %s: Title of a block, e.g. Heading. + __( 'Open %s styles in Styles panel' ), + title + ) + : undefined + } render={
} role={ !! onClick ? 'button' : null } onClick={ onClick }