Block toolbar: hide "Edit pattern" for nested patterns inside an edited parent#75762
Block toolbar: hide "Edit pattern" for nested patterns inside an edited parent#75762
Conversation
|
Size Change: +2 B (0%) Total Size: 6.84 MB
ℹ️ View Unchanged
|
f63e324 to
f7d4777
Compare
|
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. |
|
Flaky tests detected in f7d4777. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22214910347
|
|
Tested this. I think something regressed along the way (in trunk), as when clicking 'Edit pattern' every nested pattern and inner block should also be switched from contentOnly to default mode. Otherwise it get really confusing for users where they have to click Edit pattern successive times. In this video below the tan colored pattern is nested within the pattern with the black background, you can see that the nested pattern's inner blocks don't have any settings as if they were still in contentOnly mode: Kapture.2026-02-20.at.16.20.59.mp4It definitely used to work, so I'm not sure where it went wrong (probably one of my PRs!) |
|
I have an alternative here that should fix things - Fix/nested pattern section editing. It basically does the same kind of thing as this PR, but higher up the chain so that it affects not only the 'Edit pattern' button but also the block editing modes. I've run out of time to write the PR description. Will do that on Monday! |
|
This PR is a bandaid. Closing in favour of #75772, which fixes the root cause. |
What?
A Friday afternoon PR achieved without any help from AI to test if my brain hasn't disintegrated 😱
Let's hide "Edit pattern" in the toolbar for nested patterns inside an edited parent!
Related to:
Why?
When clicking "Edit pattern" on a pattern that contains nested patterns, each nested pattern was showing its own "Edit pattern" button in the block toolbar.
Since entering edit mode on the parent already unlocks all inner patterns for editing, this button was redundant and misleading.
How?
In
EditSectionButton, returnnullwhen the block is both a section block (isSectionBlock) and already inside an edited parent section (isWithinEditedSection).Testing Instructions
2025 example
Screenshots or screencast
Before
Kapture.2026-02-20.at.16.19.50.mp4
After
Kapture.2026-02-20.at.16.24.30.mp4