Conversation
|
Size Change: +25 B (0%) Total Size: 7.66 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in bf942e7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23528491327
|
|
Did you investigate trying to hook into the duplicate action and using it to also duplicate the corresponding tab menu item/tab panel block. This would mean that we can keep duplicate as an action, but we'd still solve the duplication issue. |
|
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. |
scruffian
left a comment
There was a problem hiding this comment.
This works as advertised and solves the problem, but I'm a bit reluctant to add a new block support if we don't need it. If there's no clean/simple way to handle duplication in the block then this seems like the best alternative.
|
I think adding a new block support is the simplest way to remove this button, without introducing any block-specific logic or other side effects. We could also hide the button by setting |
What?
Alternative to #76449
Follow-up to #75954
Adds an
__experimentalDuplicateblock support flag and uses it to disable the "Duplicate" block action for Tabs-related blocks (tab,tab-panel,tabs-menu,tabs-menu-item).I'm not sure if we need to include "experimental" in the name of this property, maybe just "duplicate" would be better. This would be similar to the "multiple" property (which controls whether more than one block instance can exist).
Why?
Duplicating individual Tabs inner blocks (tabs, tab panels, menu items) in isolation breaks the synchronised relationship between those components, i.e. a duplicated tab panel won't have a corresponding tab menu item, and vice versa. Disabling "Duplicate" for these blocks prevents an inconsistent state.
How?
__experimentalDuplicateblock support (defaults to true)BlockActionsto check this support flag before offering the duplicate action"__experimentalDuplicate": falsein block.json fortab,tab-panel,tabs-menu, andtabs-menu-itemTesting Instructions
Use of AI Tools
This PR was written with assistance from Claude Code. All code changes were reviewed by the author.