[go: nahoru, domu]

Skip to content
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

Merged
merged 4 commits into from
Aug 21, 2023

Conversation

adrianaixba
Copy link
Collaborator

Fail audit if the viewport's initial-scale value is less than 1.

fixes #15266

@adrianaixba adrianaixba requested a review from a team as a code owner August 18, 2023 00:43
return {
hasViewportTag: true,
isMobileOptimized: false,
parserWarnings: warnings,
Copy link
Collaborator Author

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?

Copy link
Member

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.

@@ -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) {
Copy link
Member

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.

core/test/computed/viewport-meta-test.js Outdated Show resolved Hide resolved
@adrianaixba adrianaixba merged commit cd09b63 into main Aug 21, 2023
29 checks passed
@adrianaixba adrianaixba deleted the viewport-meta branch August 21, 2023 19:37
@tunetheweb tunetheweb mentioned this pull request May 27, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Viewport audit does not flag for initial-scale < 1
3 participants