-
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
Style element for "Skip to content" produces HTML validation error #31365
Comments
I found the function that prints these styles in
For now, I'm going to turn them off with |
To put it simply, the validator is wrong and that is a false positive.
Everything is possible.... But fixing something that is not a problem just because a tool reports a false-positive would just be wrong 👍 |
The WHATWG spec currently used by the W3C validator specifies that a style element is contained within the head: Why didn't Gutenberg print style elements inside the body until the 10.5.2 patch? |
https://www.w3.org/TR/html52/document-metadata.html#the-style-element styles can be inside the body in HTML5, It was not allowed in HTML4.
Because it didn't need to. Now it needs to, and it does. This instance is not the only one, there are multiple elements that do this.For example layouts CSS is printed inline using a |
Closing due to lack of activity for almost 4 months. |
This seems to have changed again, the W3C link now redirects to the WHATWG spec one. The line:
has been removed from the allowable contexts for |
Description
I recently updated to Gutenberg 10.5.2 and I noticed that my posts now contain a
<style>
element inside the page’s<body>
with styles pertaining to the “Skip to content” link (an accessibility feature that appears when a page is loaded and the user presses tab). Thus when a post is submitted to W3.org’s HTML Validator, it reports the following error:Can this style element be moved to the head?
Step-by-step reproduction instructions
<style id="skip-link-styles">
Expected behaviour
Posts are valid HTML
Actual behaviour
Posts fail HTML validation
Screenshots or screen recording (optional)
Code snippet (optional)
WordPress information
Device information
The text was updated successfully, but these errors were encountered: