wpt / css / css-anchor-position / anchor-scroll-fixedpos-nested-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-scroll-fixedpos-nested-001.html

<!DOCTYPE html>
<title>Fixed-positioned element nested in anchor-scroll-adjusted container doesn't double-compensate for viewport scroll</title>
<link rel="author" href="mailto:fantasai@inkedblade.net">
<link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#default-scroll-shift">
<link rel="match" href="reference/anchor-scroll-fixedpos-nested-001-ref.html">
<style>
body {
  margin: 0;
  width: 1000px;
  height: 1000px;
}

div {
  width: 50px;
  height: 50px;
}

#anchor1 {
  position: absolute;
  left: 150px;
  top: 150px;
  anchor-name: --a1;
  background: orange;
}

#anchor2 {
  position: absolute;
  left: 250px;
  top: 250px;
  anchor-name: --a2;
  background: teal;
}

#f1 {
  position: fixed;
  position-anchor: --a1;
  position-area: bottom right;
  background: yellow;
}

#f2 {
  position: fixed;
  position-anchor: --a2;
  position-area: bottom right;
  background: aqua;
}

#f3 {
  position: fixed;
  position-anchor: --a1;
  position-area: bottom right;
  margin-top: 100px;
  background: aqua;
}
</style>

<div id="anchor1"></div>
<div id="anchor2"></div>
<div id="f1">
  <div id="wrapper">
    <div id="f2"></div>
    <div id="f3"></div>
  </div>
</div>

<script>
document.documentElement.scrollLeft = 100;
document.documentElement.scrollTop = 100;
</script>

/css/css-anchor-position/reference/anchor-scroll-fixedpos-nested-001-ref.html

<!DOCTYPE html>
<style>
body {
  margin: 0;
  width: 1000px;
  height: 1000px;
}

div {
  width: 50px;
  height: 50px;
}

#anchor1 {
  position: absolute;
  left: 150px;
  top: 150px;
  background: orange;
}

#anchor2 {
  position: absolute;
  left: 250px;
  top: 250px;
  background: teal;
}

#f1 {
  position: fixed;
  left: 100px;
  top: 100px;
  background: yellow;
}

#f2 {
  position: fixed;
  left: 200px;
  top: 200px;
  background: aqua;
}

#f3 {
  position: fixed;
  left: 100px;
  top: 200px;
  background: aqua;
}
</style>

<div id="anchor1"></div>
<div id="anchor2"></div>
<div id="f1"></div>
<div id="f2"></div>
<div id="f3"></div>

<script>
document.documentElement.scrollLeft = 100;
document.documentElement.scrollTop = 100;
</script>