#59505 closed defect (bug) (fixed)
Fix HTML5 validation error for skip-link css on footer
Reported by: | plugindevs | Owned by: | westonruter |
---|---|---|---|
Milestone: | 6.4 | Priority: | normal |
Severity: | normal | Version: | 5.9 |
Component: | Themes | Keywords: | has-patch has-screenshots commit |
Focuses: | css | Cc: |
Attachments (2)
Change History (12)
This ticket was mentioned in PR #5355 on WordPress/wordpress-develop by @plugindevs.
14 months ago
#1
Fix the following HTML5 validation error by moving skip-link
CSS to head from the body:
Error: Element style not allowed as child of element body in this context. (Suppressing further errors from this subtree.)
Trac ticket: https://core.trac.wordpress.org/ticket/59505
#2
@
14 months ago
- Severity changed from critical to normal
- Version changed from trunk to 5.9
Hi and thanks for the report!
If the function name should change, the old function would need to be moved to deprecated.php
.
However, I think moving the CSS might be simpler now that the script is registered and enqueued instead of printing it all directly into the footer.
If my proof-of-concept patch is good, it probably should also have some documentation updates and backward compatibility code for anyone who removed the_block_template_skip_link
from the wp_footer
action. That includes the AMP plugin, WeCodeArt and emulsion themes, plus some others in a GitHub code search.
This ticket was mentioned in PR #5472 on WordPress/wordpress-develop by @westonruter.
14 months ago
#3
Trac ticket: https://core.trac.wordpress.org/ticket/59505
#4
@
14 months ago
Note that there are other instances where a style
can appear in the body
. Also, this is what print_late_styles()
is for. See also https://github.com/WordPress/gutenberg/issues/38917
That being said, it makes sense to me that this should be moved from wp_footer
to wp_enqueue_scripts
, especially after #58775 and #58664.
@sabernhardt I've put your patch into a new PR and added the back-compat code: https://github.com/WordPress/wordpress-develop/pull/5472
cc @spacedmonkey
#5
@
14 months ago
With the back-compat code, a plugin can still do the following to remove the skip link:
<?php remove_action( 'wp_footer', 'the_block_template_skip_link' );
#7
@
14 months ago
- Keywords commit added
- Owner changed from < plugindevs > to westonruter
This PR looks good. I like that is fixes an outstanding issue on gutenberg as well. Assigning to @westonruter to commit.
@westonruter commented on PR #5472:
14 months ago
#9
Committed in r56932.
Screenshot of the Error