[Webkit-unassigned] [Bug 198784] New: rootMargin detection fails when `root` is an element

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 11 23:16:19 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=198784

            Bug ID: 198784
           Summary: rootMargin detection fails when `root` is an element
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: nospamthankyou at ericdeis.com

Effected versions: Safari 12.1.1, iOS Safari 12.3.1, Safari Technology Preview (Safari 13.0, WebKit 14608.1.25.2), and iOS Chrome 75.0.3770.70. Works however in desktop chrome Version 74.0.3729.169.

rootMargin detection does not work when the root is an element. Instead isIntersecting is only true when it is absolutely in the viewport.

basic example.

    var scrollableContainer = document.querySelector("#scrollableContainer");

    var observer = new IntersectionObserver(
      entries => {
        entries.forEach(entry => {
          if (entry.isIntersecting) {
            entry.target.style.background = "green";
            console.log("is inviewport");
            this.set("viewportEntered", true);
          } else {
            entry.target.style.background = "red";
            this.set("viewportEntered", false);
            console.log("is outside viewport");
          }
        });
      },
      {
        root: scrollableContainer,
        threshold: [0, 0.5, 1],
        rootMargin: "500px"
      }
    );

    observer.observe(this.element);

If you want a fully reproducable web demo, let me know.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190612/3419079d/attachment.html>


More information about the webkit-unassigned mailing list