Bug 245361
Summary: | window.innerWidth and window.innerHeight change when pinch-zooming in | ||
---|---|---|---|
Product: | WebKit | Reporter: | Bramus <bramus> |
Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | bfulgham, hi, simon.fraser, zalan |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Bramus
(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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Simon Fraser (smfr)
I think we have an older bug about this.
Alexey Proskuryakov
*** This bug has been marked as a duplicate of bug 174362 ***