Bug 207089 - Fixed elements should stay fixed with pinch-to-zoom
Summary: Fixed elements should stay fixed with pinch-to-zoom
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: Safari 13
Hardware: Mac macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-01 01:38 PST by cc.glows
Modified: 2022-02-03 23:32 PST (History)
5 users (show)

See Also:


Attachments
Video demonstration of the reproduction (2.14 MB, video/quicktime)
2020-02-01 01:48 PST, cc.glows
no flags Details
Test HTML (858 bytes, text/html)
2020-02-03 10:39 PST, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description cc.glows 2020-02-01 01:38:12 PST
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>
Comment 1 cc.glows 2020-02-01 01:48:10 PST
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.
Comment 2 Radar WebKit Bug Importer 2020-02-02 13:13:49 PST
<rdar://problem/59097233>
Comment 3 Simon Fraser (smfr) 2020-02-03 10:39:03 PST
Created attachment 389537 [details]
Test HTML