Skip to content

Add the captureControls block support and opt in the quote block - #81464

Draft
ellatrix wants to merge 8 commits into
trunkfrom
add/capture-controls-block-support
Draft

Add the captureControls block support and opt in the quote block#81464
ellatrix wants to merge 8 commits into
trunkfrom
add/capture-controls-block-support

Conversation

@ellatrix

@ellatrix ellatrix commented Aug 12, 2026

Copy link
Copy Markdown
Member

What?

See #61209. Adds a captureControls block 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?

  1. getControlsCapturingParent (private selector): topmost captureControls ancestor of the selection; content-locked sections take precedence.
  2. mayDisplayControls mounts the capturing block's fills and suppresses the selection's.
  3. Toolbar, popover anchor, and inspector render the capturing block; a CapturedBlockSelector tile shows the deepest selected block, or the count for a multi-selection.
  4. expandedControlsBlock (ephemeral state) disables the capture after the tile is clicked, until the selection leaves the block or lands on it.

Testing Instructions

  1. Insert a quote with two paragraphs and click into one: quote toolbar and inspector show, with a paragraph tile at the toolbar's end.
  2. Click the tile: paragraph toolbar and inspector show; the sibling paragraph keeps them; selecting the quote or leaving it collapses back.
  3. Multi-select both paragraphs: quote toolbar with a "2 blocks" tile.
  4. npm run test:e2e -- --project=chromium editor/various/captured-block-controls.spec.js

Testing 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

Collapsed (paragraph selected) Expanded (after activating the tile)
The quote toolbar with the paragraph tile at its end The paragraph toolbar after activating the tile

Use of AI Tools

Authored by Claude (Fable 5) in collaboration with @ellatrix.

ellatrix and others added 6 commits August 11, 2026 21:15
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>
@github-actions github-actions Bot added [Package] Block library /packages/block-library [Package] Block editor /packages/block-editor labels Aug 12, 2026
@github-actions

Copy link
Copy Markdown

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.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Block library, [Package] Block editor.

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.

@github-actions

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ellatrix <ellatrix@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Size Change: +1.03 kB (+0.01%)

Total Size: 7.71 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 459 kB +619 B (+0.14%)
build/scripts/block-library/index.min.js 357 kB +12 B (0%)
build/styles/block-editor/style-rtl.css 20.2 kB +105 B (+0.52%)
build/styles/block-editor/style-rtl.min.css 17.2 kB +101 B (+0.59%)
build/styles/block-editor/style.css 20.2 kB +97 B (+0.48%)
build/styles/block-editor/style.min.css 17.2 kB +100 B (+0.58%)

compressed-size-action

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ellatrix
ellatrix marked this pull request as draft August 12, 2026 04:45
@ellatrix ellatrix mentioned this pull request Aug 12, 2026
65 tasks
@Mamaduka

Copy link
Copy Markdown
Member

There's already a __experimentalExposeControlsToChildren Block API; how is this different from it?

Do we have other use cases for this new API? Lots of internal changes and a new concept just for a single block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants