| Summary: | Fixed elements should stay fixed with pinch-to-zoom | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | cc.glows | ||||||
| Component: | Scrolling | Assignee: | Nobody <webkit-unassigned> | ||||||
| Status: | NEW --- | ||||||||
| Severity: | Normal | CC: | brian, kyle.bavender, simon.fraser, thorton, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | Safari 13 | ||||||||
| Hardware: | Mac | ||||||||
| OS: | macOS 10.15 | ||||||||
| Attachments: |
|
||||||||
Created attachment 389456 [details]
Video demonstration of the reproduction
Attached a video that was missing in the original post. Apologies for the redundant wording in it — I can't edit it.
Created attachment 389537 [details]
Test HTML
|
When pinch-to-zooming, `fixed` elements don't stay fixed for a period and can be scrolled, but elements positioned relative to it with `fixed` get positioned incorrectly when using `getBoundingClientRect()`. This doesn't occur when zoomed out normally (0:00 - 0:05). When pinch to zooming as well, fixed elements can suddenly disappear after zooming in with pinch-to-zoom. Scroll down to the bottom right of the page in the repro and zoom in. Minimal reproduction: <!DOCTYPE html> <title>Basic Visual Test</title> <style> body { height: 3000px; width: 3000px; } #reference { position: fixed; top: 150px; left: 150px; width: 200px; height: 200px; background-color: red; box-shadow: inset 0 0 0 1px black; } #popper { width: 100px; height: 100px; background-color: rebeccapurple; box-shadow: inset 0 0 0 1px black; } </style> <div id="reference">Reference Box</div> <div id="popper">Popper Box</div> <script> popper.style.position = 'fixed'; function update() { const refRect = reference.getBoundingClientRect(); const popRect = popper.getBoundingClientRect(); popper.style.left = `${refRect.right}px`; popper.style.top = `${refRect.top + popRect.height / 2}px`; } window.addEventListener('scroll', update); update(); </script>