Match focus order to visual order #827
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed solution
Thank you for providing an amazing library.
I'm a member of the Gutenberg project (part of WordPress) and provide our own
ResizableBox
component that wraps this library.Our own component supports the same props as the library, and additionally renders a focusable button element via the
handleComponent
prop to allow the user to focus the resizer and resize it via keyboard events (Example).I noticed that because the
Resizer
components are always rendered together after itschildren
, sometimes the focus order doesn't match the visual order.This PR splits the
renderResizer()
into before and after thechildren
, which should make the focus order and visual order match.Testing Done
I've created a temporary story to test this PR, and if it makes sense I'd like to delete it after you review it.
The URL for the storybook is http://localhost:6066/?path=/story/handle--multiple.
The video below shows how pressing the tab key moves focus when children contains focusable elements:
Before
before.mp4
After
after.mp4