-
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
Layout of post-template is broken on the editor when query block displayLayout is type flex. #37681
Comments
Ah ha. I saw this behavior too when I reported this issue: #37645 Something funky seems to have changed with the Query loop block recently. cc @ntsekouras |
This seems relevant (introduced by #36431). I don't have a good grasp yet of what's going on, but maybe @andrewserong or @ramonjd can help enlighten? 🙏 |
Based on the comment here, it seems to be both a fix for render flickering and a possible optimisation. However, by toggling What I would try to do is preserve the overall idea of cached elements by way of |
👋 A lot of the good stuff is stored in @andrewserong's brain, which is still enjoying a well-deserved break. The above approach sounds very promising. Nevertheless, I'll flag it as something for us to keep an eye on. Thank you! |
For fun, I tried returning
Also, I'm not yet sure this is relevant, but I noticed when blockContext.postId === ( activeBlockContextId || blockContexts[ 0 ]?.postId ); But in a grid layout, clicking on the second or third item will fail. I was wondering if it should be blockContext.postId === ( activeBlockContextId || blockContexts[ index ]?.postId ) It removes the flicker effect, but also multiselects similar blocks Also probably a question for @andrewserong when he gets back. I don't have the full context yet. 🍺 |
@annezazu @ntsekouras query-post-template-gap.mov |
Thanks for the discussion, folks (and for the fix, Nik!)
Good point, I initially tried returning So, it is a bit of awkward code, but 🤞 the performance benefit for interacting within the block outweighs the workaround. I'm very happy for us to change the implementation of course, if anyone comes up with a way to do it with a cheaper mount / unmount! |
@ramonjd is that still an issue that we need to look into? From memory the fallback to |
I wasn't really sure and had only a shallow reading of the code. So, no: if you think it's good, then it's good 👍 |
Description
On Gutenberg 12.2.0, Layout of post-template is broken on the editor when query block displayLayout is type flex.
When one list in the post-template is selected, the list (.block-editor-block-preview__live-content) becomes display:none, but it exists in the code. (At the same time, a .block-editor-block-list__layout is created.)
So the unintended list becomes :nth-child(3n) and margin-right:0 is applied.
It seems to be difficult to fix in CSS, but what do you think?
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
reco.mp4
Environment info
WordPress 5.8.2
Gutenberg 12.2.0
TwentyTwentyTwo Theme
Chrome (latest versions)
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: