-
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
Writing Flow: Avoid auto-focus on nested blocks #5092
Conversation
// Avoid selecting the target if it's: | ||
// - The default block appender (or generally uneditable) | ||
// - Within a nested block | ||
if ( target.readOnly || target.closest( '[data-block]' ) !== blockContainer ) { |
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.
This breaks some behaviors:
- splitting inside container blocks like "columns".
- selecting an image and hitting Enter inside container blocks
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.
Hmm, I can confirm this, though I wouldn't have expected it, since these behaviors should be finding inputs within the selected block, at which point it should be finding the selected nested's inputs correctly. Will investigate...
There's a few related issues which contribute to the breakage in nested writing flow:
|
Or we could add a |
On second thought, even though this is true, the later insertion of the default block should change the selection and trigger another |
In fact, I think these are the same issue: That the second component updates, but the new default block isn't yet present in the DOM, same as noted for splitting. |
Closed in favor of #5102 |
Related: #4872 (comment)
This pull request seeks to resolve an issue where it is difficult to use the ellipsis More Options menu for the Column block due to focus transitioning into the block. The changes here revise the logic for focusing the newly-selected block to ensure that the selected block is not within a nested block, since if it is, the selected block will change and the menu will become dismissed.
Testing instructions:
Verify that you can open the More Options ellipsis menu, both for the Columns block and a non-nesting block. In the latter case, ensure that focus is still transitioned within the block.
Verify there are no regressions in the behavior where this auto-focus behavior is necessary: