RESOLVED DUPLICATE of bug 174362 245361
window.innerWidth and window.innerHeight change when pinch-zooming in
https://bugs.webkit.org/show_bug.cgi?id=245361
Summary window.innerWidth and window.innerHeight change when pinch-zooming in
Bramus
Reported 2022-09-19 05:58:39 PDT
(This issue is filed as a result of the Interop 2022 Viewport Investigation Effort. It was originally discussed at https://github.com/web-platform-tests/interop-2022-viewport/issues/9, with people from Apple/WebKit attending.) As per spec[^2]: > The innerWidth attribute must return the viewport width including the size of a rendered scroll bar (if any), or zero if there is no viewport. The same principle applies to `window.innerHeight` Through testing[^3], turns out WebKit-based browsers – both on Mobile and Desktop – adjust these values as you pinch-zoom in on the page. This behavior is not according to spec and not interoperable as other engines do not adjust the value. Should authors want to get the actual visible area in CSS pixels, they can use the Visual Viewport for exactly that. --- Steps to reproduce: 1. Visit https://interop-2022-viewport.netlify.app/combined/viewport-units/ 2. Note the reported value for `window.innerHeight` in the top green box 3. Pinch-zoom in 4. Check the reported value for `window.innerHeight` in the top green box again Expected result: The value remains the same Actual result: The value has changed --- [^1]: https://github.com/web-platform-tests/interop-2022-viewport/ [^2]: https://github.com/web-platform-tests/interop-2022-viewport/blob/main/explainers/sizing.md#windowinnerwidth-and-windowinnerheight [^3]: https://github.com/web-platform-tests/interop-2022-viewport/blob/main/explainers/sizing.md#findings
Attachments
Simon Fraser (smfr)
Comment 1 2022-09-19 12:32:21 PDT
I think we have an older bug about this.
Alexey Proskuryakov
Comment 2 2022-09-20 19:03:07 PDT
*** This bug has been marked as a duplicate of bug 174362 ***
Note You need to log in before you can comment on or make changes to this bug.