-
Notifications
You must be signed in to change notification settings - Fork 384
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
Meta tag invalid property error #4722
Comments
Interesting. I’m not able to reproduce that issue. I’ve tried editing Twenty Twenty’s header.php to supply this meta viewport: <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=5"/> When I validate the page, I get no validation error. If I change it to: <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=5,foo=bar"> Then I get one validation error: “Invalid property: foo”. It then says that the original invalid property value was:
Which is correct. So I’m confused why this is happening for you. What happens if you remove the (unnecessary) trailing XML self-closing slash from the <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=5"> |
According to the screenshot, you have a property I guess that some code within the theme fails generating a valid property because it doesn't receive Finding that broken piece of code and fixing it should get rid of the above validation error. |
@schlessera apparently there is no PHP generation of the |
@westonruter Note that the screenshot shows something else than the issue description. |
Ah, just read through the support ticket. The GH issue here is misleading, actually. I'm thinking it could also be a part of our processing code that fails in producing a valid attribute somewhere. I'll double-check. |
Removing the trailing self-closing slash makes no difference.
The tag is hard coded into the head, the code is: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=5"/>
<?php wp_head(); ?>
</head> |
I just saw something pop up in a support forum topic which appears to be a similar issue here:
This is line in question:
|
@joshcronin Do you have I found a way to reproduce the problem, with this plugin code: add_action( 'wp_head', function () {
?>
<style>
@media screen {
@viewport {
width: device-width;
}
}
</style>
<?php
} ); The fix is to correct how --- a/includes/sanitizers/class-amp-style-sanitizer.php
+++ b/includes/sanitizers/class-amp-style-sanitizer.php
@@ -2079,7 +2079,7 @@ class AMP_Style_Sanitizer extends AMP_Base_Sanitizer {
if ( ! $sanitized ) {
$at_rule_processed_list = $this->process_css_list( $css_item, $options );
if ( ! empty( $at_rule_processed_list['viewport_rules'] ) ) {
- $viewport_rules[] = $at_rule_processed_list['viewport_rules'];
+ $viewport_rules = array_merge( $viewport_rules, $at_rule_processed_list['viewport_rules'] );
}
$validation_results = array_merge( |
Since the PR has been fixed and the commit cherry-picked onto the |
Bug Description
The AMP validation is picking up an invalid property in the viewport meta tag even though the property it is saying is invalid does not exist.
Expected Behaviour
Viewport meta tag should not be flagged as invalid.
Steps to reproduce
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=5"/>
Invalid property: 0
Screenshots
Additional context
Originally reported in support forum topic.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: