Repository navigation
Conversation
|
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. |
There was a problem hiding this comment.
Pull request overview
Adds pattern insertion entry points to the block “Options” (block settings) menu while in zoom-out mode, allowing users to open the Patterns Explorer and insert a pattern before/after the currently selected section.
Changes:
- Add “Add before” / “Add after” menu items in zoom-out mode that open the Patterns Explorer modal with a computed insertion index.
- Track the relevant insertion index (before/after) from the block settings menu to drive pattern insertion placement.
- Update the zoom-out Site Editor E2E assertion to expect the new menu items.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/e2e/specs/site-editor/zoom-out.spec.js | Updates zoom-out options menu assertion to include “Add before/after”. |
| packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js | Adds zoom-out-only menu items that open PatternsExplorerModal at a computed insertion index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| await expect( optionsMenu ).toHaveText( [ | ||
| 'Duplicate', | ||
| 'Add before', | ||
| 'Add after', | ||
| 'Delete', | ||
| ] ); |
| test( 'Zoom out selected section has four items in options menu', async ( { | ||
| page, | ||
| } ) => { | ||
| // open the inserter | ||
| await page | ||
| .getByRole( 'button', { | ||
| name: 'Block Inserter', | ||
| exact: true, | ||
| } ) | ||
| .click(); | ||
| // switch to patterns tab | ||
| await page.getByRole( 'tab', { name: 'Patterns' } ).click(); | ||
| // search for a pattern | ||
| await page | ||
| .getByRole( 'searchbox', { name: 'Search' } ) | ||
| .fill( 'Footer' ); | ||
| // click on Footer with colophon, 3 columns | ||
| await page | ||
| .getByRole( 'option', { name: 'Footer with colophon, 3 columns' } ) | ||
| .click(); | ||
|
|
||
| // open the block toolbar more settings menu | ||
| await page.getByLabel( 'Block tools' ).getByLabel( 'Options' ).click(); | ||
|
|
||
| // get the length of the options menu | ||
| const optionsMenu = page | ||
| .getByRole( 'menu', { name: 'Options' } ) | ||
| .getByRole( 'menuitem' ); | ||
|
|
||
| // we expect 2 items in the options menu: Duplicate and Delete. | ||
| await expect( optionsMenu ).toHaveCount( 2 ); | ||
| await expect( optionsMenu ).toHaveText( [ | ||
| 'Duplicate', | ||
| 'Add before', | ||
| 'Add after', | ||
| 'Delete', | ||
| ] ); |
|
Size Change: +173 B (0%) Total Size: 8.04 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in aeae58e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26363779820
|
What?
Adds Add before and Add after actions to the block settings menu while zoomed out. These actions open the Patterns Explorer from the stacked modal PR and insert the selected pattern before or after the selected section.
Stacking
This PR is intentionally stacked on #78604 (
rich/zoom-out-pattern-modal). Review #78604 first. After #78604 lands, this PR can be rebased/retargeted ontotrunkwith a small diff limited to the menu entry points and test update.Why?
Zoom-out mode should expose pattern insertion from the section options menu, not only from the in-between inserter affordance.
How?
PatternsExplorerModalwith the correct insertion index.Testing Instructions
WP_ENV_PORT=8890 WP_ENV_PHPMYADMIN_PORT=9001 npm run wp-env start.Automated testing
npm run lint:js -- packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js test/e2e/specs/site-editor/zoom-out.spec.js