-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
core(viewport-meta): include initial-scale value condition #15394
Conversation
return { | ||
hasViewportTag: true, | ||
isMobileOptimized: false, | ||
parserWarnings: warnings, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case this fails here, should we add a warning indicating the value of initial-scale
is invalid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, I think those warnings are for if the parser encountered an error. The signal to the user here will be the audit failing.
core/computed/viewport-meta.js
Outdated
@@ -35,7 +35,16 @@ class ViewportMeta { | |||
} | |||
|
|||
const viewportProps = parsedProps.validProperties; | |||
const isMobileOptimized = Boolean(viewportProps.width || viewportProps['initial-scale']); | |||
const initialScale = viewportProps['initial-scale']; | |||
if (initialScale && initialScale < 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need an extra if
case here. WDYT about adding this condition to the isMobileOptimized
calculation below.
Fail audit if the viewport's
initial-scale
value is less than 1.fixes #15266