From 028ddeca43547356293d757d843b5f971f12d3e4 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 99881cc7627979..ed24e46743d628 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 }