wpt / css / css-anchor-position / anchor-center-scroll-001.html

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

/css/css-anchor-position/anchor-center-scroll-001.html

<!DOCTYPE html>
<title>CSS Anchor Positioning Test: scroll adjusted anchor-center</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#anchor-center">
<link rel="match" href="anchor-center-scroll-001-ref.html">
<style>
  body { margin: 0; }
  #scroller {
    width: 400px;
    height: 400px;
    overflow: auto;
    background: orange;
  }
  #anchor {
    margin-top: 100px;
    width: 100px;
    height: 100px;
    background: pink;
    anchor-name: --anchor;
  }
  #anchored {
    position: absolute;
    position-anchor: --anchor;
    align-self: anchor-center;
    width: 50px;
    height: 50px;
    background: purple;
  }
  #filler { height: 1000px; }
</style>
<div id="scroller">
  <div id="anchor"></div>
  <div id="anchored"></div>
  <div id="filler"></div>
</div>
<script>
  scroller.offsetTop;
  scroller.scrollTop = 100;
</script>

/css/css-anchor-position/anchor-center-scroll-001-ref.html

<!DOCTYPE html>
<title>CSS Test Reference</title>
<body style="margin:0">
  <div id="scroller" style="width:400px;height:400px;overflow:auto;background:orange">
    <div style="height:100px"></div>
    <div style="width:100px;height:100px;background:pink">
      <div style="height:25px"></div>
      <div style="width:50px;height:50px;background:purple"></div>
    </div>
    <div style="height:1000px"></div>
  </div>
</body>
<script>
  scroller.scrollTop = 100;
</script>