chromium/third_party/blink/web_tests/external/wpt/css/css-anchor-position/anchor-position-top-layer-002.html

<!DOCTYPE html>
<title>Top-layer element can anchor to non-top-layer fixed positioned element</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#target-anchor-element">
<link rel="author" href="mailto:[email protected]">
<link rel="match" href="anchor-position-top-layer-ref.html">

<style>
#anchor {
  position: fixed;
  top: 200px;
  left: 200px;
  width: 100px;
  height: 100px;
  background: orange;
  anchor-name: --a;
}

#target {
  top: anchor(top);
  left: anchor(right);
  width: 100px;
  height: 100px;
  background: lime;
  position-anchor: --a;
  outline: none;
}

body {
  margin: 0;
  height: 300vh;
}

dialog {
  margin: 0;
  border: 0;
  padding: 0;
  inset: auto;
}

dialog::backdrop {
  background: transparent;
}
</style>

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

<script>
target.showModal();
document.scrollingElement.scrollTop = 100;
</script>