Vladimir Levin | 7c5d9fe | 2020-03-06 18:12:50 | [diff] [blame] | 1 | <!doctype HTML> |
| 2 | <html> |
| 3 | <meta charset="utf8"> |
Vladimir Levin | 265a258 | 2020-05-04 21:14:33 | [diff] [blame] | 4 | <title>Content Visibility: focus on new element</title> |
| 5 | <link rel="author" title="Rakina Zata Amni" href="mailto:rakina@chromium.org"> |
Vladimir Levin | 458dc85 | 2020-06-09 18:29:33 | [diff] [blame] | 6 | <link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility"> |
Vladimir Levin | 265a258 | 2020-05-04 21:14:33 | [diff] [blame] | 7 | <meta name="assert" content="focus can target content-visibility: auto subtrees created while hidden"> |
Vladimir Levin | 7c5d9fe | 2020-03-06 18:12:50 | [diff] [blame] | 8 | |
Vladimir Levin | 122b110 | 2020-01-16 17:49:27 | [diff] [blame] | 9 | <script src="/resources/testharness.js"></script> |
| 10 | <script src="/resources/testharnessreport.js"></script> |
Vladimir Levin | 265a258 | 2020-05-04 21:14:33 | [diff] [blame] | 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> |
Vladimir Levin | 122b110 | 2020-01-16 17:49:27 | [diff] [blame] | 23 | |
| 24 | <script> |
Vladimir Levin | 265a258 | 2020-05-04 21:14:33 | [diff] [blame] | 25 | async_test((t) => { |
| 26 | function runTest() { |
| 27 | const focusable = document.createElement("div"); |
| 28 | focusable.tabIndex = 0; |
| 29 | container.appendChild(focusable); |
| 30 | focusable.focus(); |
Chromium WPT Sync | cb7665f2 | 2023-08-06 16:32:32 | [diff] [blame] | 31 | step_timeout(finish, 0); |
| 32 | } |
| 33 | function finish() { |
| 34 | t.step(() => assert_greater_than(document.scrollingElement.scrollTop, 500)); |
| 35 | t.done(); |
Vladimir Levin | 265a258 | 2020-05-04 21:14:33 | [diff] [blame] | 36 | } |
| 37 | onload = requestAnimationFrame(() => requestAnimationFrame(runTest)); |
| 38 | }, "Using tabindex to focus an newly constructed element in an auto subtree focuses element"); |
Vladimir Levin | 122b110 | 2020-01-16 17:49:27 | [diff] [blame] | 39 | </script> |
Vladimir Levin | 265a258 | 2020-05-04 21:14:33 | [diff] [blame] | 40 | </html> |