-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Block Editor: Fix stale insertion point reference #71559
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
Conversation
|
Size Change: +26 B (0%) Total Size: 1.93 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 1d58322. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/17573116090
|
Popovers should now run their onClose callback when unmounted. Does that help fix this? |
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @CreativeDive. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
|
@jeryj, unfortunately, that doesn’t fix this case, there’s no “blur” or “focus outside”. The popover unmounts because of parent component’s render condition. |
ramonjd
left a comment
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.
Nice catch. On trunk the inbetween inserter chokes and never returns!
This PR fixes it for me. I tested in post/site editors. If other folks have no objections LGTM 💯
Before
2025-09-10.11.21.14.mp4
After
2025-09-10.11.22.14.mp4
Unlinked contributors: CreativeDive. Co-authored-by: Mamaduka <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: ndiego <[email protected]>
What?
Closes #65598.
PR fixes stale values for insertion point references, which happens when
BlockPopoverInbetweenunmounts its children.Why?
openRef.current) flag to avoid triggering other insertion points, while Quick Inserter is open. Its value is set totruewhen an inserter is open and resets to default (false) on close.BlockPopoverInbetweenwill unmount its children , which results in a staleopenRefflag, since Popovers don't triggeronClosecallback during unmount.How?
Use a ref callback and reset the reference when the
Insertercomponent unmounts. A bit of a hacky solution, but I couldn't think of anything better without making a breaking change to popovers.Testing Instructions
Testing Instructions for Keyboard
Same
Screenshots or screencast
CleanShot.2025-09-09.at.09.45.17.mp4