OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html lang=en> |
| 3 <meta charset="utf-8"> |
| 4 <title>Selectors Level 4: focus-within</title> |
| 5 <link rel="author" title="Keyong Li" href="mailto:kli79@bloomberg.net"> |
| 6 <link rel="author" title="Florian Rivoal" href="mailto:florian@rivoal.net"> |
| 7 <link rel="help" href="https://drafts.csswg.org/selectors-4/#focus-within-pseudo
"> |
| 8 <link rel="match" href="focus-within-001-ref.html"> |
| 9 <meta name="flags" content="interact"> |
| 10 <meta name="assert" content="Test that :focus-within applies to an element with
tabindex when :focus applies."> |
| 11 <style> |
| 12 /* Suppress things that cannot be reproduced in the reference file */ |
| 13 :focus { |
| 14 outline: none; |
| 15 } |
| 16 |
| 17 /* Use blue to indicate that the user needs to pay attention. |
| 18 This element needs to be focused for the test to make sense. */ |
| 19 div { |
| 20 border: solid 15px blue; |
| 21 } |
| 22 div:focus { |
| 23 border-color: red; |
| 24 } |
| 25 div:focus-within { |
| 26 border-color: green; |
| 27 } |
| 28 </style> |
| 29 <p>Test passes if, when the element below is focused, it is surrounded by a thic
k green border. There must be no red or blue once it is focused.</p> |
| 30 <div id="focusme" class="reftest-wait" onfocus="this.classList.toggle('reftest-w
ait');" tabindex="1">Focus this element</div> |
| 31 <script> |
| 32 /* This script is an optional convenience, |
| 33 simply removing the need to manually focus the element. |
| 34 The test is valid even if the script is not run. */ |
| 35 var focusme = document.getElementById('focusme'); |
| 36 focusme.focus(); |
| 37 </script> |
| 38 </html> |
OLD | NEW |