Skip to content

Commit

Permalink
Make social icon one arrow key instead of two to move between
Browse files Browse the repository at this point in the history
blockProps makes each top level item a tabindex=0 for navigating between them. In the unique case of social icons, it's a list of LIs with a focusable button inside of it. This means each social icon is _two_ indistinguishable keypresses to move between them. What's more is an enter keypress to open the popover only works when you're on the button, but it's not possible to know which one.

By adding the tabindex=-1, we make the LI that doesn't have an onClick get skipped so we only need one keypress and always land on the one that has the interaction to open the popover.
  • Loading branch information
jeryj authored and getdave committed Sep 4, 2024
1 parent 18164f0 commit 49c47e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-library/src/social-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const SocialLinkEdit = ( {
onChange={ ( value ) => setAttributes( { rel: value } ) }
/>
</InspectorControls>
<li { ...blockProps }>
<li { ...blockProps } tabIndex={ -1 }>
<button
className="wp-block-social-link-anchor"
ref={ setPopoverAnchor }
Expand Down

0 comments on commit 49c47e2

Please sign in to comment.