content-visibility-084.html (1126B)
1 <!doctype HTML> 2 <html class="reftest-wait"> 3 <meta charset="utf8"> 4 <title>Content Visibility: anchor links prevented on hidden</title> 5 <link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> 6 <link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility"> 7 <link rel="match" href="spacer-and-container-ref.html"> 8 <meta name="assert" content="anchor link scroll is prevented when the target is hidden"> 9 10 <script src="/common/reftest-wait.js"></script> 11 12 <style> 13 .spacer { 14 width: 150px; 15 height: 3000px; 16 background: lightblue; 17 } 18 #container { 19 width: 150px; 20 height: 150px; 21 background: red; 22 } 23 24 .hidden { 25 content-visibility: hidden; 26 } 27 28 #target { 29 width: 100px; 30 height: 100px; 31 } 32 </style> 33 34 <div class="spacer">Test passes if there is no red.</div> 35 <div id="container"><div id="target"></div></div> 36 37 <script> 38 function tryToScroll() { 39 location.href += "#target"; 40 requestAnimationFrame(takeScreenshot); 41 } 42 43 function runTest() { 44 container.classList.add("hidden"); 45 requestAnimationFrame(tryToScroll); 46 } 47 48 window.onload = () => { requestAnimationFrame(runTest); }; 49 </script> 50 </html>