NEW 267493
scrollBy() causes getBoundingClientRect to report incorrect value when page is zoomed
https://bugs.webkit.org/show_bug.cgi?id=267493
Summary scrollBy() causes getBoundingClientRect to report incorrect value when page i...
Nathan Manceaux-Panot
Reported 2024-01-13 03:25:22 PST
Created attachment 469388 [details] Repro page On macOS Safari, when page zoom is used, calling scrollBy() causes getBoundingClientRect() to report incorrect values. As soon as the user scrolls, values returned by getBoundingClientRect() become correct again. Note: I'm not sure what “correct” should be here, so as a test, I'm using getBoundingClientRect()+scrollBy() to align an element to the top of the viewport. This worked as expected in previous versions of Safari. But, even if this behavior wasn't the intended one, it's still a relevant test: it shows that the behavior of getBoundingClientRect() *changes when scrolling using scrollBy(), versus when the user scrolls*. # Repro I've attached a repro page, which is also available here: https://www.cykeprojects.com/temp/2024-01-13/getBoundingClientRect-and-page-zoom-bug-repro.html # Context In other browsers (Firefox 121.0.1, Chrome 120.0.6099.216), and older versions of Safari, the behavior was a expected: getBoundingClientRect() values didn't change based on how the page was last scrolled, and using them with scrollBy() reliably allowed for aligning an element to the top of the viewport.
Attachments
Repro page (5.30 KB, text/html)
2024-01-13 03:25 PST, Nathan Manceaux-Panot
no flags
Radar WebKit Bug Importer
Comment 1 2024-01-20 03:26:14 PST
Note You need to log in before you can comment on or make changes to this bug.