Skip to content

[cssom-view] visual viewport sometimes reportedly cannot fully scale out to layout viewport #9118

@lpd-au

Description

@lpd-au

I have an older site with a viewport meta tag like this: <meta name="viewport" content="width=1024">.

When fully pinch-zoomed out on a mobile device (and upon first loading), I would expect the visual viewport to be at minimum 1024 CSS pixels wide, matching the layout viewport. However, depending on the mobile device, that isn't always the case.

Here's my simplified test case: https://output.jsbin.com/xesolop
And here's the widths reported by the Visual Viewport API:

PIXEL 6 PRO

Firefox:
- Portrait:  1024
- Landscape: 1024

Chrome
- Portrait:  1024
- Landscape: 1023.9999389648438

PIXEL 7

Firefox
- Portrait:  1024
- Landscape: 1023.9833374023438

Chrome
- Portrait:  1023.9998779296875
- Landscape: 1024

GALAXY S23

Firefox:
- Portrait:  1024
- Landscape: 1024

Chrome
- Portrait:  1024
- Landscape: 1024

Is reporting 1023.9 (when fully pinch-zoomed out) expected/allowed behaviour? From my point of view, it's undesirable behaviour since it complicates detecting when the user has either pinch-zoomed in or refreshed the page whilst zoomed (visualViewport.width < 1024).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions