Tabs: Clean up Edit components#77426
Conversation
The class was never referenced in styles or tests, so it only added noise to the generated className list. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
useBlockProps hard-codes role="document", id, and aria-label on every block wrapper for JAWS screen reader compatibility (see #29526), so the role/id/aria-controls/aria-labelledby/aria-selected props passed from the tab, tabs-menu, and tabs-menu-item edit components were silently discarded or pointed at IDs that no longer exist in the editor DOM. Drop the dead attributes and the now-unused identifiers that supported them. The save output is unchanged, so the tablist/tab/tabpanel roles still apply on the front end. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
useInnerBlocksProps already injects __unstableLayoutClassNames from context, so passing it through useBlockProps in tab, tabs, and tabs-menu duplicated the layout classes (is-layout-flow etc.) on the wrapper element. tabs-menu-item opted into layout support only to suppress the editing UI, but its CSS does not rely on is-layout-* classes, so the layout support is dropped entirely to keep the editor and frontend markup aligned. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The core/tabs block defines activeTabIndex with a default of 0 in block.json, so the value supplied via block context is never undefined. Remove the `?? 0` fallback in tab and tabs-menu-item editors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The tab/edit.js refactor removed the last usage of slugFromLabel but left the file behind. Nothing imports it now, so drop it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The .wp-block-tabs__title element was removed along with the tab name editing UI (#75554), but the display:none rule for it lived on in style.scss with nothing to target. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Both tab-panel and tabs-menu only read a single value from the store, so the object-return and block-body wrappers add noise without value. Flatten to an arrow-expression returning the root clientId directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The removed doc comments only restate what the variable names already convey, adding no context beyond the identifier. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Size Change: -441 B (-0.01%) Total Size: 7.75 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 d52b100. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24512319758
|
mikachan
left a comment
There was a problem hiding this comment.
Thanks for this! The changes look great to me, and the Tabs block still works as expected. I think we should bring this in.
|
Thanks for the review! |

What?
Cleanup pass over the Tabs block family's editor components. Removes dead code, redundant prop plumbing, attributes that the block editor overrides, and orphaned files left behind by recent refactors.
How?
Remove the
roleandidprops from the blocks: For accessibility reasons, the block'sroleis enforced asdocumentand cannot be overridden. The id prop is also automatically generated from theclientIdand cannot be overwritten.gutenberg/packages/block-editor/src/components/block-list/use-block-props/index.js
Lines 182 to 183 in 7563e2a
The fact that
roleandidcannot be changed means that ARIA attributes following the accordion pattern are unnecessary in the editor. In other words, ARIA attributes such asaria-labelledby,aria-controls, andaria-selectedhave no meaning and can be removed.Additionally, unnecessary code like the following was removed:
__unstableLayoutClassNames)activeTabIndexfallbackTesting Instructions
Smoke test the Tabs block. It should work the same as before.
Use of AI Tools
This PR was prepared with assistance from Claude Code (Opus 4.6); each commit was reviewed, tested, and is the responsibility of the author.