-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement roving tabindex on the Image block #22696
Conversation
Size Change: +62 B (0%) Total Size: 1.12 MB
ℹ️ View Unchanged
|
<ToolbarItem> | ||
{ ( toggleProps ) => ( | ||
<DropdownMenu | ||
icon={ <RotateLeftIcon /> } | ||
label={ __( 'Rotate' ) } | ||
popoverProps={ POPOVER_PROPS } | ||
toggleProps={ toggleProps } | ||
controls={ [ | ||
{ | ||
icon: <RotateLeftIcon />, | ||
title: __( 'Rotate left' ), | ||
isDisabled: inProgress, | ||
onClick: () => | ||
this.adjustImage( | ||
'rotate', | ||
{ | ||
angle: -ROTATE_STEP, | ||
} | ||
), | ||
}, | ||
{ | ||
icon: <RotateRightIcon />, | ||
title: __( 'Rotate right' ), | ||
isDisabled: inProgress, | ||
onClick: () => | ||
this.adjustImage( | ||
'rotate', | ||
{ | ||
angle: ROTATE_STEP, | ||
} | ||
), | ||
}, | ||
] } | ||
/> | ||
) } | ||
</ToolbarItem> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff got messed up. But this is basically wrapping <DropdownMenu>
with <ToolbarItem>
and passing the toolbar item props to toggleProps
:
<ToolbarItem>
{ ( toggleProps ) => (
<DropdownMenu
...
toggleProps={ toggleProps }
/>
) }
</ToolbarItem>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is this features that hide whitespace changes:
It isn't perfect but it helps to review PRs that contain indentation changes like in here.
It seems like the sooner we add deprecation message the better. #21024 introduced some code that uses the old approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, and it works for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 from me! Tested locally, and navigating through blocks via Tab and Arrows was as expected and advertised :)
Thank you @diegohaz for your continued efforts in improving the Toolbar and a11y! 🙌
This PR is part of #18619, whose main goal is to implement roving tabindex on the
@wordpress/components
'Toolbar
component and to use it on the header and block toolbars so they become a single tab stop as recommended by the WAI-ARIA Toolbar Pattern. Related issues are #15331 and #3383.This PR continues the work done in #20008, but specifically for the Image, Cover and Media & Text blocks.
How to test
Check Image, Cover and Media & Text blocks toolbars. Use Tab and arrow keys to move focus.