-
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: Don't close the inserter when focusing outside it #67838
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. |
Note: This issue first appeared in WP 6.7, so it might be worth backporting it to WP 6.7.2. |
Size Change: -29 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in 9ebf0e8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12408246905
|
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.
I wonder if the fix should be with the appender focus on close behavior you found. Rather than always focusing the appender when the quick inserter gets closed, we only want to focus the appender when escape
is pressed. I wonder if the fix in the social icon PR was too heavy handed and needs to be revisited.
packages/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js
Show resolved
Hide resolved
I opened #67851 to see if removing the part you found would fix it as well. It does seem to be working cleanly and handles the focus and closing. |
29a9ecf
to
2ea929c
Compare
2ea929c
to
9ebf0e8
Compare
If it makes the main inserter behavior more consistent between all editors, then I think it's a good idea. |
What?
Fixes #67809
In the widget editor, if you click "Browse all" after clicking the button inserter, the main inserter doesn't open. To solve this issue, we will not close the main inserter even if the focus is outside of it.
Why?
I identified this issue as being caused by #64877. The most likely cause is as follows, but note that there are two issues intertwined:
useDialog
hook. Since the button inserter is focused again, it is determined that "the outside is focused" and the main inserter that is about to be opened is immediately closed. This behavior is inconsistent with other editors, which is the second problem.How?
This PR removes the
useDialog
hook to only solve the second issue, meaning that the main inserter will not be closed when focus is gained outside of it, which makes it consistent with the behavior of other editors.Related PR: #61004
Testing Instructions
Screenshots or screencast
Before
before.mp4
After
after.mp4