Status: PASS | Duration: 9ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi
/css/css-anchor-position/scroll-to-anchored-fixed-006.html
<!DOCTYPE html> <html class=reftest-wait> <title>Test: Scroll-to-Focus Fixed position-area Box Horizontal</title> <link rel="help" href="https://www.w3.org/TR/css-anchor-position/#scroll"> <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#focus-management-apis"> <link rel="match" href="scroll-to-anchored-fixed-006-ref.html"> <link rel="stylesheet" href="/fonts/ahem.css"> <style> /* Force scrolling. */ body { border: solid silver; height: 100vh; width: 100vw; } .anchor { position: absolute; top: 100%; left: 100%; width: 100vw; height: 100vh; border: solid silver; anchor-name: --foo; } /* Attach to anchor in horizontal axis */ .fixed { position: fixed; position-anchor: --foo; position-area: span-all center; place-self: start; top: calc(100vh - 5em); padding: 1em 2em; border: solid orange 10px; margin: 5px; } /* Avoid pixel differences. */ .fixed { font-family: Ahem; } a:focus { outline: solid blue; } </style> <input value="Tab to the next link →"><br> <em>This should trigger a scroll operation...</em> <div class=anchor></div> <div class=fixed> <p><a href="" id=test>One</a> <p><a href="">Two</a> <p><a href="">Three</a> </div> <script> function raf() { return new Promise(resolve => requestAnimationFrame(resolve)); } async function runTest() { await raf(); document.getElementById('test').focus(); await raf(); document.documentElement.classList.remove('reftest-wait'); } runTest(); </script>
/css/css-anchor-position/scroll-to-anchored-fixed-006-ref.html
<!DOCTYPE html> <html class=reftest-wait> <title>Reference: Scroll-to-Focus Fixed position-area Box Vertical</title> <link rel="stylesheet" href="/fonts/ahem.css"> <style> /* Force scrolling. */ body { border: solid silver; height: 100vh; width: 100vw; } .anchor { position: absolute; top: 100%; left: 100%; width: 100vw; height: 100vh; border: solid silver; anchor-name: --foo; } /* Attach to anchor in horizontal axis */ .fixed { position: absolute; position-anchor: --foo; position-area: span-all center; place-self: start; top: calc(100vh - 5em); padding: 1em 2em; border: solid orange 10px; margin: 5px; } /* Avoid pixel differences. */ .fixed { font-family: Ahem; } a:focus { outline: solid blue; } </style> <input value="Tab to the next link →"><br> <em>This should trigger a scroll operation...</em> <div class=anchor></div> <div class=fixed> <p><a href="" id=test>One</a> <p><a href="">Two</a> <p><a href="">Three</a> </div> <script> function raf() { return new Promise(resolve => requestAnimationFrame(resolve)); } async function runTest() { await raf(); document.getElementById('test').focus(); await raf(); window.scroll(window.scrollX, 0); await raf(); document.documentElement.classList.remove('reftest-wait'); } runTest(); </script>