Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-anchor-position/position-visibility-anchors-visible-non-intervening-container.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="assert" content="position-visibility: anchors-visible should consider the visibility of the anchor relative the containing scroller, ignoring visibility in other scrollers." />
<title>CSS Anchor Positioning Test: position-visibility: anchors-visible</title>
<link rel="match" href="position-visibility-anchors-visible-non-intervening-container-ref.html">
<style>
#non-intervening-scroll-container {
overflow: hidden;
width: 200px;
height: 200px;
position: relative;
}
#position-container {
position: relative;
}
#scroll-container {
overflow: hidden scroll;
width: 400px;
height: 100px;
}
#anchor {
anchor-name: --a1;
width: 100px;
height: 100px;
background: orange;
}
#spacer {
height: 100px;
}
#target {
position-anchor: --a1;
position-visibility: anchors-visible;
position-area: right;
width: 100px;
height: 100px;
background: green;
position: absolute;
top: 0;
left: 0;
}
</style>
<div id="non-intervening-scroll-container">
<div id="position-container">
<div id="scroll-container">
<!-- The anchor is not visible to the screen, but it is visible in the -->
<!-- containing block of anchor1 and target1, so the target should not -->
<!-- be hidden due to position-visibility: anchors-visible. -->
<div id="anchor">anchor</div>
<div id="spacer"></div>
<div id="target">target</div>
</div>
</div>
</div>
<script>
const non_intervening_scroller = document.getElementById('non-intervening-scroll-container');
non_intervening_scroller.scrollLeft = 100;
</script>