focus-visible-023.html (1375B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <title>CSS Test (Selectors): Element doesn't match :focus-visiblel after blur</title> 4 <link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/css/support/parsing-testcommon.js"></script> 9 <style> 10 :focus-visible { 11 outline: green solid 5px; 12 } 13 </style> 14 15 <div id="target" tabindex="0">Target</div> 16 <script> 17 // Check that :focus-visible is supported. 18 test_valid_selector(':focus-visible'); 19 20 async_test(function(t) { 21 target.addEventListener("focus", t.step_func(function() { 22 assert_equals(getComputedStyle(target).outlineStyle, "solid", `outline-style for ${target.tagName}#${target.id} should be solid`); 23 assert_equals(getComputedStyle(target).outlineColor, "rgb(0, 128, 0)", `outlineColor for ${target.tagName}#${target.id} should be green`); 24 target.blur(); 25 })); 26 target.addEventListener("blur", t.step_func(function() { 27 assert_equals(getComputedStyle(target).outlineStyle, "none", `outline-style for ${target.tagName}#${target.id} should be none`); 28 t.done(); 29 })); 30 target.focus(); 31 }, ":focus-visible stop matching after blur"); 32 </script>