-
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
ResizableEditor: Fix tab order for resize handles #57475
Conversation
Size Change: -1 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
@t-hamano thank you. However, as I mentioned in #52602 (comment) I think The root problem is that, regardless of the amount of the enabled handles and their order, all the handles are rendered after the object they apply to, so that the visual order and DOM order mismatch anyways. This PR is an improvement because, at least, the left handle receives focus before the right handle. However, they both come after the resizable object so that the tab order is still unexpected. See screenshot below: |
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.
Agreed, this is an improvement over the current behavior, and although it's not a guaranteed stable fix I see zero downsides to this trivial code change 👍
Should this change be reactive to LTR vs RTL languages? |
I also tested this PR in RTL languages. In RTL languages, when you press the tab key, the focus moves from the right handle to the left handle. |
Found while searching for a solution to #52602
What?
This PR is a small improvement that fixes the order of tab focus in canvases that have resizing handles on both sides, such as Pattern editor, Template Part editor, and Style book.
In other words, when you press the Tab key, instead of focusing on the right handle and then the left handle, it focuses on the left handle and then the right handle.
Why?
The
ResizableBox
component usesre-resizable
component internally. This component renders resize handles based on theenable
prop, but the order in which each handle is rendered depends on the order of the enable prop's keys. In the object currently being passed, theright
key is before theleft
key, so the right handle is rendered before the left handle, causing confusion in the tab focus order.How?
Relying on the internal implementation of the library and the order of the keys may be a little unstable, but I changed the order of the keys.
This PR does not solve #52602 because the resize handles are rendered after the child (iframe). In the future, we may need to look for a better solution.
Testing Instructions for Keyboard
Screenshots or screencast
d6c37c9db05638a79c0e22e1f9b41195.mp4