Check the number of h1 elements on block theme templates#468
Check the number of h1 elements on block theme templates#468matiasbenedetto wants to merge 3 commits intomasterfrom
Conversation
|
In general, I like the concept of this check, but I don't think it should produce a Required notice that would block submission of a theme to the directory. Theme Check is primarily for ensuring that themes meet the WordPress.org Theme Review Guidelines. If we want to add a Required-level notice, it should first be discussed by the Themes Team, agreed upon, and added to the guidelines. I have no issues with either of the first two items being a Warning-level notice for all block themes or even Required for themes with the |
Thanks for pointing this out @justintadlock. I agree with making both WARNING instead of REQUIRED following the a11y requirements linked. I changed that here: c05ac27 |
|
Multiple H1 headings is not something we should warn against... It's a perfectly valid pattern and does have valid use cases |
@aristath The a11y requirements from the Theme Handbook says something different:
Should we modify the a11n requirements or add this to the plugin? I'm not sure. |
|
What is going to count as a template? |
The "Single H1 heading" rule is mostly a remnant of the HTML4 days... |
What?
Check the number of h1 elements on each block theme template.
This check only runs when checking block themes.
Results:
h1tags, it outputs a REQUIRED change error.h1tags, it outputs a WARNING.h1tag, it outputs nothing.How
It iterates over each block of a template and looks for core/heading or core/post-title with level one to determine the number of h1 blocks that will be printed on a page.
Why?
To help theme creators use one
h1tag per template following accessibility recommendations like: https://www.a11yproject.com/posts/how-to-accessible-heading-structure/Screenshot
Results in wp-admin:

Results in CLI:
