content-visibility-050.html (1154B)
1 <!doctype HTML> 2 <html> 3 <meta charset="utf8"> 4 <title>Content Visibility: focus on new element</title> 5 <link rel="author" title="Rakina Zata Amni" href="mailto:rakina@chromium.org"> 6 <link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility"> 7 <meta name="assert" content="focus can target content-visibility: auto subtrees created while hidden"> 8 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 12 <style> 13 .auto { 14 content-visibility: auto; 15 } 16 .spacer { 17 height: 3000px; 18 } 19 </style> 20 21 <div class=spacer></div> 22 <div id=container class=auto></div> 23 24 <script> 25 async_test((t) => { 26 function runTest() { 27 const focusable = document.createElement("div"); 28 focusable.tabIndex = 0; 29 container.appendChild(focusable); 30 focusable.focus(); 31 step_timeout(finish, 0); 32 } 33 function finish() { 34 t.step(() => assert_greater_than(document.scrollingElement.scrollTop, 500)); 35 t.done(); 36 } 37 onload = requestAnimationFrame(() => requestAnimationFrame(runTest)); 38 }, "Using tabindex to focus an newly constructed element in an auto subtree focuses element"); 39 </script> 40 </html>