-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Unable to dismiss block inserter panel after inserting a V2 block #43090
Comments
Can replicate with Gutenberg Version 13.8.2. This feels like a pretty bad bug considering. Going to flag in #core-editor. |
Had a quick look to try and see when it was introduced, but was able to replicate as far back as 12.9, so just isolating the cause and fixing in trunk is probably going to be quicker/easier than a git bisect/blame. I probably won't have time to have a closer look until tomorrow, so if someone else wants to take a look in the mean time go for it. |
Thanks @glendaviesnz , it would be great if you could have a look at it 🙂 |
Thanks for reporting this @mmtr!
What do you mean by **For the below text pay attention to the difference of After digging a bit, in order for this to happen, the inserted block needs to satisfy a couple of conditions:
In the main inserter when we insert the block we select it(in the store) but not focus it, so as the inserter remains open. With the above conditions, when we insert let's say the |
I didn't have much time to look at this today, but the PR that introduced the focus criteria for closing is here, and I confirmed that switching back to a simple toggle fixes the issue of it not closing, but reintroduces the focus trap issue that this PR fixed. |
A block registered using the block API Version 2. That could have been a wrong assumption from my end though, since I couldn't reproduce this on blocks using the Version 1, but maybe because I was missing the other conditions you noted. |
@ntsekouras That makes sense. It seems that we need some kind of focus loss detection in the inserter when it's supposed to stay focused. That said, it's a bit tricky because we rely on the focus loss happening to actually close the inserter in several situations:
|
Do we have any possible solution for this issue? I noticed that this is causing some E2E test failures. |
Confirmed that this remains an issue in Gutenberg trunk (~15.1) |
Adding this to the WP 6.2 project board's todos. |
This comment from @youknowriad seems to imply that this code is in place to ensure this doesn't happen: gutenberg/packages/block-editor/src/components/inner-blocks/use-inner-block-template-sync.js Lines 108 to 109 in 6611f8e
Something must have changed that caused it to stop working. For me, I'd question whether selecting the templated inner It can lead to some weird situations, like if you try inserting four quotes in a row from the library, it actually does something weird where the quotes are recursively nested. I'm not sure the quote block should allow other quotes within it anyway, but still, the issue is that the person inserting the block is not necessarily aware of the context change around where blocks are being inserted. |
What's stopping us from calling |
Description
After using the block inserter panel to insert a V2 block like the Buttons block, it is not possible to dismiss the panel.
Step-by-step reproduction instructions
+
icon to open the block inserter panel.x
icon to close the block inserter panel.Screenshots, screen recording, code snippet
Screen.Recording.2022-08-10.at.11.55.35.mov
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: