Skip to content

Commit

Permalink
Add role='button' to social icon button to override document role
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Nov 18, 2024
1 parent 41a2708 commit 22d205e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/block-library/src/social-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,14 @@ const SocialLinkEdit = ( {
backgroundColor: iconBackgroundColorValue,
} }
>
<button aria-haspopup="dialog" { ...blockProps }>
{ /*
* Disable reason: The `button` ARIA role is redundant but
* blockProps has a role of `document` automatically applied
* which breaks the semantics of this button since it removes
* the information about the popover.
*/
/* eslint-disable jsx-a11y/no-redundant-roles */ }
<button aria-haspopup="dialog" { ...blockProps } role="button">
<IconComponent />
<span
className={ clsx( 'wp-block-social-link-label', {
Expand All @@ -199,6 +206,7 @@ const SocialLinkEdit = ( {
{ socialLinkText }
</span>
</button>
{ /* eslint-enable jsx-a11y/no-redundant-roles */ }
{ isSelected && showURLPopover && (
<SocialLinkURLPopover
url={ url }
Expand Down

0 comments on commit 22d205e

Please sign in to comment.