WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.54k stars 4.21k forks source link

Template level blocks can be unlocked and moved when template preview is active #67082

Open fabiankaegy opened 1 week ago

fabiankaegy commented 1 week ago

In WordPress 6.7 there is a regression in the handling of Blocks that are part of the template but that remain editable.

For example the post title or the post featured image blocks remain editable when they are part of the template when the "Show Template" option is enabled in the editor.

In WordPress 6.7 these blocks now suddenly show a lock icon in their block toolbar. Clicking that allows editors to unlock and then move them.

This moving doesn't get persisted luckily. But it still created a broken editorial experience for users.

https://github.com/user-attachments/assets/c947f1fc-e9a9-44ea-b6a8-316c32b82009

fabiankaegy commented 1 week ago

Looking further into this it appears this has already been fixed in Gutenberg. So we need to find the PR and add that to the backport list

Image

youknowriad commented 1 week ago

Hey folks, this seems to be a 6.7 only bug, I can't reproduce on Gutenberg trunk. I think it might be related to the block toolbar updates that were done specifically on that branch. Any ideas @getdave @ellatrix

getdave commented 6 days ago

Nothing springs to mind. There was a lot of divergence between trunk and wp/6.7 during the Beta/RC period as trunk continued to evolve in/around Zoom Out and changes to "Write mode" so it would have been easy for something to have been missed.

Also cc @cbravobernal who is leading 6.7.X releases from Editor side.

getdave commented 6 days ago

I noticed isDefaultEditingMode seems to be missing from the packages/block-editor/src/components/block-toolbar/index.js file in wp/6.7 but it is there in trunk.

https://github.com/WordPress/gutenberg/blob/c43a0c9944b33ad01fa2805a02a171b42b791282/packages/block-editor/src/components/block-toolbar/index.js#L205-L209

I tried adding it in and it seemed to fix things.

Haven't had much time to test but here is a PR

t-hamano commented 4 days ago

66200, which was manually backported to wp/6.7, appears to be related.

Here, both isDefaultEditingMode and isContentOnlyEditingMode were removed. The removal of isContentOnlyEditingMode seems to have been intentional, but the removal of isDefaultEditingMode might not have been.

getdave commented 4 days ago

So can we tweak https://github.com/WordPress/gutenberg/pull/67121 to resolve?