Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
 - This WPT test may be referenced by the following Test IDs:
            
- /css/selectors/focus-visible-027.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Test (Selectors): :focus-visible after click and input type change</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<input type="button" value="+">
<script>
  let input = document.querySelector("input");
  input.addEventListener("click", function(e) {
    if (this.type != "button") {
      return;
    }
    this.value = "";
    this.type = "text";
  });
  promise_test(async function() {
    await test_driver.click(input);
    assert_equals(input.type, "text");
    assert_equals(input.matches(":focus"), input.matches(":focus-visible"), "Type change to text might cause :focus-visible to start matching");
  });
</script>