Repository navigation
Grid: Show the canvas handles in a small toolbar, and add a Canvas block - #84947
Draft
draganescu wants to merge 49 commits into
Draft
draganescu wants to merge 49 commits into
draganescu wants to merge 49 commits into
Conversation
The drag and rotate handles were two separate buttons in different corners of the block. They are now one small block toolbar outside the block, under its bottom right corner and clear of the bottom resize handle, with a third button that deletes the block. GridItemHandles owns the overlay over the block and the toolbar, which stays upright as the block turns. The drag, rotate and delete handles are buttons in it. The delete button only shows when the block can be removed, and like the others it only works with a pointer: keyboard users delete blocks from the block toolbar's options menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…em-handles-toolbar # Conflicts: # packages/block-editor/src/components/grid/grid-item-rotator.tsx
draganescu
added this pull request to stack #84511
October 16, 2026 16:05
🤖 PR meta 🤖📦 Bundle sizeSize Change: +833 B (+0.01%) Total Size: 9.09 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Backspace in
|
This was referenced Oct 16, 2026
…em-handles-toolbar
With the grid interactivity experiment, the inserter offers Canvas: a Group with a full width grid of 12 columns and 12 rows in manual placement mode, so a free-form layout can be added in one step instead of adding a Grid and changing its settings. It sets no padding, so it gets whatever the theme gives Groups. Its isActive keys are more specific than Grid's, so a manual grid shows as Canvas and other grids still show as Grid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…em-handles-toolbar
…em-handles-toolbar # Conflicts: # packages/block-editor/src/components/grid/grid-item-rotator.tsx
…em-handles-toolbar # Conflicts: # packages/block-editor/src/components/grid/grid-item-rotator.tsx
The toolbar was placed under the block's own bottom right corner and turned upright around its center, so on a rotated block it moved around the block and could cover it. It now stays upright under the bottom right corner of the block's bounding box, in the same place at any angle. getBoundingBoxCornerStyle() works out that point inside the overlay that turns with the block, in container units of the overlay, so it follows the block's size without measuring it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under the bottom right corner of a rotated block's bounding box, the toolbar could end up far from the block, next to an empty corner of the box. It now sits upright under the block's own lowest corner, or the right one of two level corners, picked when a rotation is released. While the block turns, it follows that corner. The corner has a fixed place in the overlay that turns with the block, so getCornerToolbarStyle() places the toolbar with percentages and the gap turned into the overlay's frame, and the overlay no longer needs to be a size container. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar # Conflicts: # packages/block-editor/src/components/grid/grid-item-drag-handle.tsx
…em-handles-toolbar
They came into the rotation helpers after those were converted to TypeScript. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar # Conflicts: # packages/block-editor/src/hooks/test/layout-child-tools.jsdom.test.tsx
…em-handles-toolbar
…em-handles-toolbar
draganescu
removed this pull request from stack #84511
October 22, 2026 14:01
draganescu
added this pull request to stack #85397
October 22, 2026 14:02
…em-handles-toolbar # Conflicts: # packages/block-editor/src/hooks/test/layout-child-tools.jsdom.test.tsx
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
Trunk now type checks block-library's tests, and the TypeScript test of the variations can't import a JavaScript module. The Canvas variation gets its own typed constant, since inside the conditional spread its scope would widen to `string[]`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar
…em-handles-toolbar # Conflicts: # packages/block-editor/src/components/grid/grid-item-rotator.tsx # packages/block-editor/src/components/grid/rotation.ts # packages/block-editor/src/components/grid/test/rotation.test.ts
…em-handles-toolbar
…em-handles-toolbar # Conflicts: # packages/block-editor/src/components/grid/grid-item-drag-handle.tsx
Read the grid interactivity flag in the block's init instead of at module load, so the variation doesn't depend on the order of the scripts. Give Canvas a tile in the Group placeholder and an example for the inserter preview, and add a CHANGELOG entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The corner toolbar was plain divs with titles, hidden from assistive technology. It is now a labelled Toolbar. Delete is a ToolbarButton, so it can be reached from the keyboard; Drag and Rotate are Buttons left out of the tab order, like the drag handle of the block toolbar, since they only work with a pointer. Add a CHANGELOG entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…em-handles-toolbar
25 tasks
This branch has not been deployed
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?
Behind the
gutenberg-grid-interactivityexperiment, the handles of a selected block in a manual placement grid become one small toolbar under the block, with a new button that deletes the block. Part of the grid stack, on top of #84894. This is a try to see how manipulating blocks on the canvas feels with the handles together.Why?
The handles are what you reach for when arranging blocks on the canvas, and with one in each corner the pointer has to travel around the block between them. Together, they are in one place and read as one small block toolbar, in the editor's own visual language. Deleting is the other common action when arranging a layout, and otherwise needs the block toolbar's options menu.
Starting a free-form layout took several steps: insert a Grid, switch it to manual placement, set its columns and rows, and make it full width. Canvas does that in one.
How?
GridItemHandles(components/grid/grid-item-handles.tsx) owns the popover over the block, which follows its rotation, and draws the toolbar in it. The toolbar is placed upright, 8px under the block's bottom right corner and right-aligned with it, clear of the resize handle in the middle of the bottom side.getLowestCorner()inrotation.js, from the saved angle); while the block turns, the toolbar follows the corner it started from.getCornerToolbarStyle()places the toolbar there with percentages, adds the gap turned into the overlay's frame, and turns the toolbar back by the block's angle. Unit tests check the corner picked and the toolbar's place on screen at several angles.GridItemDragHandle,GridItemRotatorand the newGridItemDeleteHandle(components/grid/grid-item-delete-handle.tsx) no longer have popovers of their own. They areGridItemHandlebuttons in the toolbar. The rotator finds the block's center from the toolbar's box, which turns around it.--wpds-*). No stroke token is as dark as the toolbar's border, so the border stays$gray-900.GridTools(hooks/layout-child.jsx), the toolbar shows when any of its buttons does. The drag button shows for blocks that can be moved, the rotate button as before, and the delete button for blocks that can be removed (canRemoveBlock).group-canvas, ingroup/variations.jsnext to Grid, with thelayouticon. Its attributes arealign: 'full'andlayout: { type: 'grid', columnCount: 12, rowCount: 12, isManualPlacement: true }. It sets no padding, so it gets whatever the theme gives Groups; a variation's attributes are fixed when it's registered, so it can't read the theme's spacing, and spacing preset slugs differ between themes.isActivekeys arelayout.typeandlayout.isManualPlacement. The editor picks the matching variation with the most keys, so a manual grid shows as Canvas and other grids still show as Grid.window.__experimentalEnableGridInteractivityis set, since manual grids can only be edited on the canvas with that experiment. The flag is set by an inline script beforewp-block-editor, whichwp-block-librarydepends on, so it is set when the variations are read.removeBlock( clientId, true ), which selects the block before it. Like the other handles, the toolbar only works with a pointer and isaria-hidden: keyboard users delete blocks from the block toolbar's options menu.Testing Instructions
Checked with Playwright in Chromium: dragging by the drag button and by an Image's body moves the block, rotating turns the block by the pointer's angle, Delete removes the block, and Canvas inserts from the inserter as a full width 12 by 12 manual grid. New unit tests cover Canvas only being offered with the experiment and which variation a grid shows as. The unit tests for the rotator and the grid tools are updated for the toolbar.
Known issues
🤖 Generated with Claude Code