focus-visible-027.html (1213B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Test (Selectors): :focus-visible after click and input type change</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="author" title="Mozilla" href="https://mozilla.org"> 6 <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo"> 7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1788698"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/resources/testdriver.js"></script> 11 <script src="/resources/testdriver-actions.js"></script> 12 <script src="/resources/testdriver-vendor.js"></script> 13 <input type="button" value="+"> 14 <script> 15 let input = document.querySelector("input"); 16 input.addEventListener("click", function(e) { 17 if (this.type != "button") { 18 return; 19 } 20 this.value = ""; 21 this.type = "text"; 22 }); 23 promise_test(async function() { 24 await test_driver.click(input); 25 assert_equals(input.type, "text"); 26 assert_equals(input.matches(":focus"), input.matches(":focus-visible"), "Type change to text might cause :focus-visible to start matching"); 27 }); 28 </script>