Bug 257375 - elem.getBoundingClientRect does not include visualViewport.offsetLeft
Summary: elem.getBoundingClientRect does not include visualViewport.offsetLeft
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: iPhone / iPad iOS 16
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-05-26 05:25 PDT by Holger Jeromin
Modified: 2023-06-02 05:26 PDT (History)
4 users (show)

See Also:


Attachments
minimal repro of the issue (2.53 KB, text/plain)
2023-05-26 05:25 PDT, Holger Jeromin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Jeromin 2023-05-26 05:25:47 PDT
Created attachment 466505 [details]
minimal repro of the issue

When the visual viewport is scaled and moved a getBoundingClientRect does not include visualViewport.offsetLeft.

In my minimal repro (attached and online https://www.katur.de/issues/safari_viewport-scaled_pos-fixed.html ) I check every 
second the BoundingClientRect of a base element and put its top,left value to the position of a position:fixed overlay element. 

This overlay element should cover the base element exactly.
On desktop and mobile Chrome+Firefox this works even with pinch zoom.
With mobile Safari I get an offset in the size of visualViewport.offsetLeft.

The repo has a second overlay which uses the same BoundingClientRect values but add visualViewport.offsetTop/Left value to the position.

With mobile Chrome+Firefox the "BCR overlay" is always over the base element even with pinch zoom.
With mobile Safari the "BCR+offset* overlay" is always over the base element even with pinch zoom.
Comment 1 Radar WebKit Bug Importer 2023-06-02 05:26:16 PDT
<rdar://problem/110164602>