-
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
Widget Editor: Focus toggle button when the global inserter is closed #68216
base: trunk
Are you sure you want to change the base?
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +20 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
// When the block is focused, the global inserter is closed, | ||
// which in turn focuses the global inserter toggle. | ||
// So we need to explicitly focus the paragraph block again. | ||
await addedParagraphBlockInFirstWidgetArea.focus(); | ||
await addedParagraphBlockInFirstWidgetArea.focus(); |
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 may seem really weird, but in the widget editor, when the content area is clicked, the global inserter is closed. As a result of this PR, the global inserter toggle is focused, so we have to focus the block again.
dfb65b4f1f445abe11a98aa0492327ff.mp4
I've also submitted #67838 to not close the global inserter when the content area is focused. If we can move forward with that PR, we won't need this hack anymore.
Flaky tests detected in 4e043a2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12450366614
|
What?
To prevent focus loss in the widget editor, the inserter toggle gets focus when the following actions are performed:
Why?
a11y. Similar implementations exist in the
editor
package, but the widget editor is implemented differently and must be implemented separately.Testing Instructions
Testing Instructions for Keyboard
You should be able to do the same thing using just the keyboard.
Screenshots or screencast
cc3c9ce84a11d2018cf618af9360d788.mp4