Conversation
|
Size Change: -103 B (0%) Total Size: 7.74 MB 📦 View Changed
ℹ️ View Unchanged
|
|
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 378cf84. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24277140730
|
mikachan
left a comment
There was a problem hiding this comment.
Thanks for this! It's a great refactor that fixes the anchor duplication.
However, one thing I liked about having the anchors on the Tab Menu Item blocks was that it was easier to see which block was linked to which tab in the list view. I don't think this is a good enough reason to keep it, but it would be nice if we could find a way to indicate which blocks are linked together.
I'm seeing an issue with the Tab Menu Item labels. If I remove a tab and then add another, the label content is duplicated:
This is obviously using the default labelling system, and in most cases, I imagine the user would've changed the label content, but I think the numbers should still increment correctly.
The front end is behaving as expected, and custom anchors seem to work well ✅
Co-authored-by: Sarah Norris <1645628+mikachan@users.noreply.github.com>
|
Thanks for the review!
This might be difficult to solve because tabs no longer have static HTML anchors. Instead, we might be able to remove the numbers from the tab labels. |
I think this is a great idea! We don't use this numbering anywhere else as far as I know, and I'm assuming it will be meaningless as soon as the user adds real content anyway. If you agree, do you think we should do it in a separate PR? If so, will leave a ✅ here. |
I prefer to do it in a separate PR 👍 |
What?
Simplifies how
core/tabandcore/tabs-menu-itemblocks are linked by replacing explicit anchor-based matching with positional (index-based) matching.Why?
In the current implementation, when a Tabs block is inserted, explicit IDs are assigned to the Tab Menu Item and Tab. This is because the synchronization between the tab block and the tab-menu-item block is based on HTML anchors, but it feels redundant;
Another problem with this approach is that when a Tabs block is duplicated, the HTML anchor is also duplicated, resulting in multiple instances of the same ID existing on the same page.
The addition, reordering, and deletion of tabs should all be manageable using an index-based approach.
How?
The basic policy is as follows:
tabs_{tabsBlockIndex}-tab-{tabIndex}.This PR also resolves a large number of browser warnings that were being logged when the Tabs block was inserted.
Testing Instructions
Use of AI Tools
This pull request was developed with the assistance of Claude Code (AI coding assistant). All generated code has been reviewed and tested by the author.