ESLint plugin: Disable jsx-a11y/heading-has-content#77073
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. |
|
Size Change: 0 B Total Size: 7.74 MB ℹ️ View Unchanged
|
|
Should we disable the (Also mentioned at #76501 (comment), with at least one real-world false positive in button tests) |
Hm, do we have a use case for this other than for |
That's a good point. I was looking at it more from a consistency of |
|
Tracking the link button problem in #77098 |
* Disable jsx-a11y/heading-has-content * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: aduth <aduth@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>
No longer needed after #77073. Made-with: Cursor
What?
Closes #76501
Turns off
jsx-a11y/heading-has-contentin the shared@wordpress/eslint-pluginjsx-a11y preset.Also removes the
eslint-disablecomments that existed only for that rule (including inPostTitle, where the visible title comes fromuseRichTexton the DOM, not from JSX children).Why?
The rule only looks at static JSX. It flags patterns like
<Text render={ <h1 /> }>Title</Text>as an empty heading, even though children are composed correctly at runtime.eslint-plugin-jsx-a11ydoes not provide a way to allowlist that pattern, so the noise was likely to grow as@wordpress/uiadoption grows.This specific accessibility lint rule wasn't added explicitly, just added as part of a broad set of accessibility lint rules. I doubt that empty headings was ever a problem that necessitated a dedicated lint rule, and now that it has tangible downsides, I think we should try removing it and see if that actually is a problem worth linting.
See #76501 for more details on the alternatives considered.
How?
'jsx-a11y/heading-has-content': 'off'inpackages/eslint-plugin/configs/jsx-a11y.js, with a short comment pointing to the issue.@wordpress/ui(Text, Card, EmptyState), Storybook, and narrow thePostTitledisable so it only coversjsx-a11y/no-noninteractive-element-to-interactive-role.Testing Instructions
npm run lint:jsUse of AI Tools
Composer 2