| <!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; | 
 |     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> |