-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Warn if there is more than one main HTML element, or if the main is missing #35354
Comments
Note from the MDN Docs:
It is possible to have more than one |
And perhaps also warn if there is no |
The accessibility features "Skip to content" + A user can so easily remove a Apart from the warning, and update on documentation would also be beneficial to add the HTML Element selector to other blocks, like post content, media+text when used in a template context. @WordPress/outreach |
Some thoughts:
|
Related to #65400. Soon Zoom Out will not be available if
|
@luminuu Looks great, would you be open to raising a PR with your code? 🙏 |
I like that the message shows as a notice this way and not as a warning in the Document Outline panel where it would be less visible. |
+1 This will be especially helpful for theme developers working on implementing zoom-out functionality. While building TT5 and working with templates that include nested groups, we encountered some challenges. |
@getdave The code is specific to a theme, I assume it has to be rewritten in order to land in core? The code can be found here: https://github.com/Greyd-Suite/greyd-wp/blob/main/assets/js/editor-main-tag-warning.js |
What problem does this address?
A few blocks have an option to change the HTML element to
<main>
, but there must only be one main element on a page.Having more than one
<main>
element (that is not hidden) is invalid HTML and an accessibility issue.What is your proposed solution?
Add a warning if there is more than one main element -perhaps in the
document outline"table of content" details popover?It already warns for incorrect heading levels.
The text was updated successfully, but these errors were encountered: