From 2a6b3a30c62f73564f5149c723985155e67a7ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Thu, 24 Nov 2022 16:54:22 +0100 Subject: [PATCH] Make more accessible --- .../post-publish-panel/maybe-upload-media.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/post-publish-panel/maybe-upload-media.js b/packages/editor/src/components/post-publish-panel/maybe-upload-media.js index 711917481ae474..0cff54ef097f8e 100644 --- a/packages/editor/src/components/post-publish-panel/maybe-upload-media.js +++ b/packages/editor/src/components/post-publish-panel/maybe-upload-media.js @@ -34,11 +34,19 @@ function flattenBlocks( blocks ) { function Image( block ) { const { selectBlock } = useDispatch( blockEditorStore ); return ( - // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions { selectBlock( block.clientId ); } } + onKeyDown={ ( event ) => { + if ( event.key === 'Enter' || event.key === ' ' ) { + selectBlock( block.clientId ); + event.preventDefault(); + } + } } key={ block.clientId } alt={ block.attributes.alt } src={ block.attributes.url }