Repository navigation
Conversation
Removes the on-canvas appender from the Buttons block and adds "Add button" to its toolbar, mirroring the Navigation prototype. The button is `<Inserter isAppender>` rather than a hand-rolled insert. `core/button` is the block's only allowed child and defines no inserter variations, so `Inserter` resolves a single block type: it renders as a one-click button and derives its own label from the block title, with no hardcoded string and no need for `directInsert`. Going through `Inserter` also keeps adjacent-sibling attribute inheritance, which the on-canvas appender provided. The existing coverage for that now inserts from the toolbar and still passes, so it is renamed to match. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkuJuaK9Vo54v3FmifLFt8
|
Size Change: +92 B (0%) Total Size: 7.91 MB 📦 View Changed
|
Contributor
Author
|
@ellatrix - Same idea as the navigation but much simpler. Removes the on canvas appender, and adds "Add button" to the toolbar. Relies on the toolbar sibling inserter for adding new button blocks. If this is the right direction, I'll clean it up and get it ready for merge. |
Member
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
A prototype, opened as a draft to look at rather than to merge. It applies the same idea as #82270 (Navigation) to the Buttons block: no on-canvas appender, and "Add button" in the block toolbar when the Buttons block is selected.
Why?
Same question as #82270 — whether "add an item" reads better in the toolbar than as a
+on the canvas. Buttons is a good second case because it is the simple version of the pattern: one allowed child, no submenu nesting, no entity loading. If the idea does not hold up here it is unlikely to hold up anywhere.How?
The button is
<Inserter isAppender>rather than a hand-rolled insert.core/buttonis the only entry in the Buttons block'sallowedBlocksand defines no inserter variations, soInserterresolves a single block type. That means it renders as a one-click button instead of a popover, andInserterTogglederives the label from the block title — so "Add button" is not hardcoded, and nodirectInsertdeclaration is needed.Going through
Inserterrather than around it also preserves adjacent-sibling attribute inheritance (getSiblingBlockAttributes, #37904), which the on-canvas appender provided. That is not an assumption:buttons.spec.jsalready covered it, and the existing test passes unchanged apart from clicking the toolbar instead of the canvas. It is renamed from "…via the appender" to "…via the toolbar" to match.Testing Instructions
+on canvas.Status
buttons.spec.jsandnavigable-toolbar.spec.js: 27 passing.inserting-blocks.spec.js: 47 passing.Unlike #82270, there is no outstanding focus-management work here — the Buttons block has none of the custom focus handling the Navigation block built around its appender.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KkuJuaK9Vo54v3FmifLFt8