wpt / css / css-anchor-position / position-visibility-anchors-visible-after-scroll-in-document.html

Status: FAIL | Duration: 10ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-anchor-position/position-visibility-anchors-visible-after-scroll-in-document.html

<!DOCTYPE html>
<html class=reftest-wait>
<meta charset="utf-8">
<meta name="assert" content="Scrolling an anchor in to view should cause a position-visibility: anchors-visible element to appear." />
<title>CSS Anchor Positioning Test: position-visibility: anchors-visible after scrolling in the document</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#position-visibility">
<link rel="match" href="position-visibility-anchors-visible-after-scroll-in-document-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/common/rendering-utils.js"></script>
<style>
  #anchor {
    anchor-name: --anchor;
    margin-left: 150vw;
    width: 100px;
    height: 100px;
    background: orange;
  }

  #spacer {
    height: 100px;
  }

  #target {
    position-anchor: --anchor;
    position-visibility: anchors-visible;
    position-area: left center;
    width: 100px;
    height: 100px;
    background: green;
    position: absolute;
    inset: 0;
  }
</style>

<div id="anchor">anchor</div>
<div id="spacer"></div>
<div id="target">target</div>

<script>
  document.documentElement.scrollLeft = 0;
  waitForAtLeastOneFrame().then(() => {
    // Scroll #anchor in to view.
    document.documentElement.scrollLeft = document.documentElement.scrollWidth;
    waitForAtLeastOneFrame().then(() => {
      takeScreenshot();
    });
  });
</script>

/css/css-anchor-position/position-visibility-anchors-visible-after-scroll-in-document-ref.html

<!DOCTYPE html>
<meta charset="utf-8">
<style>
  #anchor {
    width: 100px;
    height: 100px;
    margin-left: 150vw;
    background: orange;
  }

  #target {
    width: 100px;
    height: 100px;
    margin-top: -100px;
    margin-left: calc(150vw - 100px);
    background: green;
  }
</style>

<div id="anchor">anchor</div>
<div id="target">target</div>

<script>
  document.documentElement.scrollLeft = document.documentElement.scrollWidth;
</script>