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 the parent of an
element with tabindex where :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 #focusme:not(:focus) { |
| 20 border: solid 15px blue; |
| 21 } |
| 22 |
| 23 #target:focus-within { |
| 24 border: solid 15px green; |
| 25 } |
| 26 </style> |
| 27 <p>Test passes if, when the element below is focused, |
| 28 it is surrounded by a thick green border. |
| 29 There must be no red or blue once it is focused.</p> |
| 30 <div id="target"> |
| 31 <div id="focusme" class="reftest-wait" onfocus="this.classList.toggle('reftest
-wait');" tabindex="1">Focus this element</div> |
| 32 </div> |
| 33 <script> |
| 34 /* This script is an optional convenience, |
| 35 simply removing the need to manually focus the element. |
| 36 The test is valid even if the script is not run. */ |
| 37 var focusme = document.getElementById('focusme'); |
| 38 focusme.focus(); |
| 39 </script> |
| 40 </html> |
OLD | NEW |