Repository navigation
Conversation
- Open the Lock submenu with ArrowRight and move focus to its first option. The settings menu stops arrow keys natively, so the item listens for them itself. - Keep focus in the List View row after unlocking from its lock button. - Show the unlocked icon on the toolbar button after an unlock. - Show the List View lock button in white on selected rows, as the other row buttons are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Store the layout lock as `templateLock: 'all'`, which keeps blocks from being added, moved or removed inside, instead of `contentOnly`, which turned the block into a pattern section with an "Edit pattern" button. - Keep the blocks inside a layout-locked block in place when the lock of the block changes, instead of writing an explicit unlock that let them out. - Open the Lock submenu of the block settings menu on hover, and close it shortly after the pointer leaves it. - Use the same button for the List View lock as for the row's options menu toggle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…idth - Show a disabled partial lock on an unsynced pattern, labelled "Locked by its pattern": its layout is unlocked by editing or detaching the pattern, not from the lock controls, and the lock controls no longer detach it. - Hide the lock in List View and the block toolbar while the pattern is edited, and show it again on exit. - Disable the Layout option of the lock menu for patterns. - Span the List View lock column in rows without a lock, so every row keeps the full width of the tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. At least one To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the |
A block inside a locked regular block controls its own lock, so its List View lock button works instead of being disabled. Only blocks inside a pattern, which are edited content only, keep the disabled "Locked by" button. Replaces `getLayoutLockedAncestor` with `getParentSectionBlock`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The List View lock of an unsynced pattern is no longer disabled: it opens the same confirmation dialog as the block settings menu's Detach, titled "Detach pattern". Detaching removes the pattern association and unlocks every block inside it, so they are fully editable, in a single undo step. The pattern keeps its own movement and deletion locks. Adds the `detachPattern` private action. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit 146c1bd. The List View lock of an unsynced pattern is disabled again, labelled "Locked by its pattern"; the pattern is detached from the block settings menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds "Design" to the lock menu, stored as `lock.edit` and available for every block with the block lock menu experiment. A full lock now needs movement, deletion, layout (where the block has it) and design. A design-locked block stays selectable in the canvas, but: - its text can't be edited, and the blocks inside it are inert, selected from List View; - its own toolbar controls are hidden, keeping the lock button and the options menu; - its inspector controls, including the Styles tab, are shown disabled. Design-locking a pattern freezes its content and hides "Edit pattern". The Lock item stays in the options menu of a design-locked block, and List View keeps listing its children so each can change its own lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…letion Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renames the label, `DisabledWhenDesignLocked` (now `DisabledWhenStylesLocked`) and its class. The property is still stored as `lock.edit` and still locks editing the content and styles of the blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for your input @jasmussen. This PR is not ready for review yet, but I'm taking your thoughts to improve the work ✨ |
- The inner blocks of a block whose styles are locked can be selected in the canvas. Each one stays non-editable through its own lock. Blocks whose inner blocks come from elsewhere, like Navigation or a synced pattern, keep them out of reach. - Unlocking the styles of a block also unlocks the styles of the locked blocks above it, and unlocking its movement or deletion unlocks the layout of the parent that holds it in place. A pattern keeps its layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k type - A block whose styles are locked takes no new inner blocks, and shows no appender, so a fully locked block can't be changed by adding blocks, for example to Social Icons inside a locked Group. - The List View unlock tooltip names the block type, "Unlock Group", instead of a custom name the block may have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pattern and the blocks inside it share the List View tooltip "Locked by Pattern". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ight-click - An unlocked block shows an open lock in its List View row on hover, focus or selection. Pressing it locks every property of the block and the blocks inside it, with a snackbar to undo. - A full lock shows the lock icon and a partial lock a lock with a dash, in List View and the block toolbar. - Right-clicking the lock of a locked block or a pattern opens the lock menu at the pointer. - Replace the lockFilled icon with lockOpen and lockDashed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A locked block or pattern shows the lock icon, whether every property is locked or only some, in List View and the block toolbar. Remove the lockDashed icon. - A pattern's own layout no longer counts as a lock in List View: its row shows the open lock on hover, pressing it locks the pattern, and pressing the lock unlocks it. Its layout stays the pattern's. - The open lock of an unlocked row shows while the pointer is over the row or the button has keyboard focus, so it hides after unlocking once the pointer leaves. - Add the private hasOwnBlockLock selector. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in one click - A partial lock shows the lock with a dash again, in List View and the block toolbar, so the two lock states are told apart at a glance. Restore the lockDashed icon. - The toolbar lock of a locked block or pattern unlocks it on click, or locks it again once unlocked, and right-clicking it opens the lock menu at the pointer. - Share the right-click lock menu between List View and the toolbar, and stop announcing the List View lock as a menu button, since pressing it locks or unlocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Right-clicking the open lock of an unlocked block or pattern, in List View or the block toolbar, now opens the lock menu too. The List View open lock stays shown while its menu is open, also once focus moves into the menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ern" In the lock menu, when every block whose layout can be locked is a pattern, the disabled Layout option now has the description "Disabled by Pattern", so the checkmark is explained. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A block inside an unsynced pattern now shows the lock with a dash in List View, as its content stays editable while the rest is the pattern's, instead of a disabled open lock. Selecting one shows the same disabled "Locked by Pattern" lock in the block toolbar, which until now showed no lock for content-only blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… above A block with no template lock of its own takes the one of the block above it. Unlocking a Column inside a locked Group and Columns removed the template lock of the Column and the Columns, so both took the Group's `all` lock again, and the blocks inside the Column stayed unable to move or be removed. setBlocksLock now stores a layout unlock as `templateLock: false` where a block above still passes a lock down, and removes the attribute otherwise. The lock of each block reads the template lock its parent passes on once the changes apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Sync pattern" A synced pattern has no layout lock in the lock menu, as its layout is edited in the pattern itself. Its disabled Layout option now says why, like an unsynced pattern's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This proof of concept gathers different ideas across tickets and proposes a new mechanic for locking different types of blocks and patterns. I'd like your thoughts @annezazu @richtabor |
|
This is cool work. I love this part:
I'm still missing the Figma-like "dots" on innerblocks when a parent is locked. I don't think we have to have them, but it's a nice industry standard that could work also here. But mostly I love how super simple and predictable it is to lock. I even like that you absorbed granular locking here:
And I like the partially locked icon :
I'm not sure why "Layout" is greyed for me? One thing that needs unblocking is the menu component itself:
Something is awkward here. When I move fast, the hover state kinda "pauses" on the flyout menu. Is this using the right Menu component? The second half of this is what I mentioned already, the tension betweeen the dark-bordered toolbar borders and the present incompatibility with the Menu component. I think @jameskoster has one idea of how to solve that, but mostly this is something we need a plan for, for it to land. Nice work. |
…u item The lock options of the block settings menu stayed open for 200 ms after the pointer left the Lock item, so moving quickly through the menu paused on them. They now close as soon as the pointer moves onto another item, unless it is heading to the options across that item, the way submenus do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Great experiment, @fcoveram! It looks like we need to refactor the block Options menu to use the new I see the PR introduces edit locking; IIRC, we tried this when we first implemented block locking, but there's a lot of complexity and many ways a block can be edited. While a good experiment, I don't think it should be grouped with menu refactoring. @talldan, @ramonjd, I think you've worked on edit-locking-related features recently. Would love to know what you think. |






What?
A proof of concept for locking one or several blocks from a lock menu, as an alternative to the List View lock controls in #78612. It is behind a new Gutenberg experiment, "Block lock menu".
lockOpenandlockDashedto@wordpress/icons.Why?
Locking today goes through a modal, one block at a time, and only partly reaches the blocks inside. Several tickets explore parts of a better flow. Their ideas are the input for this PR, which is a proof of concept that connects them into one flow:
How?
isLayoutLockedBlock,canLayoutLockBlock,isPatternLockedBlockandgetBlockLockType; the List View uses the existinggetParentSectionBlockto find blocks inside a pattern.isLockedBlockalso counts a locked layout, as in Block Editor: Add layout lock option to lock modal #78608.setBlocksLock( clientIds, { move, remove, layout, edit } )that applies the lock to the blocks and their descendants in a single undo step.lock.edit, which only Navigation and synced patterns offered so far. With the experiment it is offered for every block:canEditBlockalready hides most editing UI and puts an overlay on the block, and this adds read-onlyRichText, a disabled inspector (DisabledWhenStylesLocked) and no block toolbar controls. The Lock item stays available on a styles-locked block, and List View keeps listing its children, except for Navigation, which keeps its own edit lock.templateLock: 'all', notcontentOnlyas in Block Editor: Add layout lock option to lock modal #78608, so a locked block isn't treated as a pattern section. A block with acontentOnlytemplate lock also counts as layout-locked. An unsynced pattern's layout is left to the pattern: the lock controls don't change it or detach it, unlike Block Editor: Add layout lock option to lock modal #78608.Menufrom@wordpress/ui. The block options menu is still aDropdownMenufrom@wordpress/components, which a@wordpress/uisubmenu can't nest in, so the options open in their ownMenuanchored beside the "Lock" item, on hover, click or the right arrow key. They close as soon as the pointer moves to another item, unless it is heading to the options. This PR doesn't move the block options menu itself toMenu.Buttonas the row's options menu toggle, in its own row cell; rows without a lock span that column. Its tooltip names the block type, "Lock Group" or "Unlock Group", says "Lock Pattern" or "Unlock Pattern" for a pattern, and "Locked by Pattern" for the blocks inside it. A new private selector,hasOwnBlockLock, tells whether a block has a lock of its own, leaving out a pattern's layout. Its right-click menu,BlockLockContextMenu, is aMenufrom@wordpress/uianchored at the pointer, shared with the toolbar lock; the context menu key opens it below the button. The toolbar lock is a plainToolbarButtonthat locks or unlocks on click.setBlocksLockalso unlocks a property where the blocks above hold it: the styles of locked ancestors, and thetemplateLockof the parent that keeps a block in place. A block with notemplateLockof its own takes the one of the block above it, so a layout unlock under a block that stays layout-locked is stored astemplateLock: false; otherwise the attribute is removed.canInsertBlockType, and no appender), and the inner blocks of a styles-locked block stay selectable in the canvas (__unstableHasActiveBlockOverlayActive), except where they come from elsewhere, like Navigation or a synced pattern.isLockedBlockcounting a locked layout, as in Block Editor: Add layout lock option to lock modal #78608: an unsynced pattern, or a block with its ownallorcontentOnlytemplate lock, shows the existing lock icon in List View and the lock button in the block toolbar.setBlocksLockand inserting into a styles-locked block. End-to-end tests are not written yet.Testing Instructions
Each kind of content locks a little differently, so beyond these steps, try different combinations of lock options.
Screenshots or screencast
Locking an image
Lock.a.block.mp4
Locking a group block
Lock.a.group.block.mp4
Locking a pattern
Lock.a.pattern.mp4
Locking a sync pattern
Lock.a.sync.pattern.mp4
Use of AI Tools
Written with Claude Code (Claude Opus 5.5), and reviewed and tested by the author.
🤖 Generated with Claude Code