From eb7b03a368ebb150fa8f646b688455a3c131fd65 Mon Sep 17 00:00:00 2001 From: ramon Date: Thu, 19 Oct 2023 16:11:19 +1100 Subject: [PATCH] Removing duplicate wrapper Adding disabled onClick and aria attribute --- packages/block-library/src/image/image.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/block-library/src/image/image.js b/packages/block-library/src/image/image.js index db64c947a78634..321e19a6456377 100644 --- a/packages/block-library/src/image/image.js +++ b/packages/block-library/src/image/image.js @@ -83,6 +83,11 @@ const scaleOptions = [ }, ]; +const disabledClickProps = { + onClick: ( event ) => event.preventDefault(), + 'aria-disabled': true, +}; + export default function Image( { temporaryURL, attributes, @@ -769,9 +774,7 @@ export default function Image( { } } resizeRatio={ align === 'center' ? 2 : 1 } > - { /* If the image has a href, wrap in an tag to trigger any inherited link element styles */ } - { /* eslint-disable-next-line jsx-a11y/anchor-is-valid */ } - { !! href ? { img } : img } + { img } ); } @@ -786,8 +789,13 @@ export default function Image( { which causes duplicated image upload. */ } { ! temporaryURL && controls } { /* If the image has a href, wrap in an tag to trigger any inherited link element styles */ } - { /* eslint-disable-next-line jsx-a11y/anchor-is-valid */ } - { !! href ? { img } : img } + { !! href ? ( + + { img } + + ) : ( + img + ) } { showCaption && ( ! RichText.isEmpty( caption ) || isSelected ) && (