Add the captureControls block support and opt in the quote block - #81464
Add the captureControls block support and opt in the quote block#81464ellatrix wants to merge 8 commits into
Conversation
A block opts in with the captureControls block support: the controls of its inner blocks are captured by the topmost capturing ancestor unless that ancestor is temporarily expanded. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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 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. |
|
Size Change: +1.03 kB (+0.01%) Total Size: 7.71 MB 📦 View Changed
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
There's already a Do we have other use cases for this new API? Lots of internal changes and a new concept just for a single block. |
What?
See #61209. Adds a
captureControlsblock support: while an inner block is selected, the toolbar and inspector keep showing the opted-in ancestor's controls, and the selection shrinks to a tile at the end of the toolbar. Activating the tile expands the selection's own controls. The quote block opts in.Why?
Selecting a paragraph inside a quote hides the quote's controls, notably the citation toggle. This keeps them in view without changing the selection or locking anything.
How?
getControlsCapturingParent(private selector): topmostcaptureControlsancestor of the selection; content-locked sections take precedence.mayDisplayControlsmounts the capturing block's fills and suppresses the selection's.CapturedBlockSelectortile shows the deepest selected block, or the count for a multi-selection.expandedControlsBlock(ephemeral state) disables the capture after the tile is clicked, until the selection leaves the block or lands on it.Testing Instructions
npm run test:e2e -- --project=chromium editor/various/captured-block-controls.spec.jsTesting Instructions for Keyboard
Alt+F10, arrow to the last toolbar item, Enter to expand. Known gap: focus is not moved into the re-rendered toolbar after expanding.
Screenshots or screencast
Use of AI Tools
Authored by Claude (Fable 5) in collaboration with @ellatrix.