-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check the number of h1 elements on block theme templates #468
base: master
Are you sure you want to change the base?
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:
h1
tags, it outputs a REQUIRED change error.h1
tags, it outputs a WARNING.h1
tag, 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
h1
tag per template following accessibility recommendations like: https://www.a11yproject.com/posts/how-to-accessible-heading-structure/Screenshot
Results in wp-admin:
Results in CLI: