Skip to content

Commit

Permalink
Make more accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Nov 24, 2022
1 parent 0aabc03 commit 2a6b3a3
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
<motion.img
tabIndex={ 0 }
role="button"
aria-label={ __( 'Select image block.' ) }
onClick={ () => {
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 }
Expand Down

0 comments on commit 2a6b3a3

Please sign in to comment.