focus-visible-024.html (1922B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <title>CSS Test (Selectors): Element matches :focus-visiblel after accesskey</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 <meta name="assert" content="This test checks that :focus-visible matches after focusing an element using accesskey."> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <script src="/resources/accesskey.js"></script> 13 <script src="/css/support/parsing-testcommon.js"></script> 14 <style> 15 :focus-visible { 16 outline: green solid 5px; 17 } 18 </style> 19 20 <div id="targetA" tabindex="0" accesskey="a">Target A</div> 21 <button id="targetB" tabindex="0" accesskey="b">Target B</button> 22 <script> 23 // Check that :focus-visible is supported. 24 test_valid_selector(':focus-visible'); 25 26 promise_test(async t => { 27 await pressAccessKey("a"); 28 assert_equals(getComputedStyle(targetA).outlineStyle, "solid", `outline-style for ${targetA.tagName}#${targetA.id} should be solid`); 29 assert_equals(getComputedStyle(targetA).outlineColor, "rgb(0, 128, 0)", `outlineColor for ${targetA.tagName}#${targetA.id} should be green`); 30 t.done(); 31 }, ":focus-visible matches after accesskey on DIV"); 32 33 promise_test(async t => { 34 await pressAccessKey("b"); 35 assert_equals(getComputedStyle(targetB).outlineStyle, "solid", `outline-style for ${targetB.tagName}#${targetB.id} should be solid`); 36 assert_equals(getComputedStyle(targetB).outlineColor, "rgb(0, 128, 0)", `outlineColor for ${targetB.tagName}#${targetB.id} should be green`); 37 t.done(); 38 }, ":focus-visible matches after accesskey on BUTTON"); 39 </script>