4 <meta charset=
"utf-8" />
5 <title>CSS Test (Selectors): Keyboard focus enables :focus-visible
</title>
6 <link rel=
"author" title=
"Alice Boxhall" href=
"aboxhall@chromium.org" />
7 <link rel=
"help" href=
"https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
8 <script src=
"/resources/testharness.js"></script>
9 <script src=
"/resources/testharnessreport.js"></script>
12 outline: darkgreen auto
5px;
15 :focus:not(:focus-visible) {
16 background-color: tomato;
22 This test checks that any element focused programmatically on page load will have
<code>:focus-visible
</code> matching enabled.
23 <ul id=
"instructions">
24 <li>If the element that says
"I will be focused automatically" has a red background, then the test result is FAILURE. If the element has a green outline, then the test result is SUCCESS.
</li>
27 <div id=
"el" tabindex=
"-1">I will be focused automatically.
</el>
29 window
.addEventListener('load', () => {
33 async_test(function(t
) {
34 el
.addEventListener("focus", t
.step_func(function() {
35 assert_equals(getComputedStyle(el
).outlineColor
, "rgb(0, 100, 0)");
38 }, "Programmatic focus on page load bshould match :focus-visible");