tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

focus-visible-025.html (2469B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8" />
      3 <title>CSS Test (Selectors): Element matches :focus-visiblel after accesskey after previous mouse focus</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, even when previously another element has been focused by mouse click.">
      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="initial" tabindex="0">Initial</div>
     21 <div id="targetA" tabindex="0" accesskey="a">Target A</div>
     22 <button id="targetB" tabindex="0" accesskey="b">Target B</button>
     23 <script>
     24  // Check that :focus-visible is supported.
     25  test_valid_selector(':focus-visible');
     26 
     27  promise_test(async t => {
     28    await test_driver.click(initial);
     29    assert_equals(getComputedStyle(initial).outlineStyle, "none", `outline-style for ${initial.tagName}#${initial.id} should be none`);
     30 
     31    await pressAccessKey("a");
     32    assert_equals(getComputedStyle(targetA).outlineStyle, "solid", `outline-style for ${targetA.tagName}#${targetA.id} should be solid`);
     33    assert_equals(getComputedStyle(targetA).outlineColor, "rgb(0, 128, 0)", `outlineColor for ${targetA.tagName}#${targetA.id} should be green`);
     34    t.done();
     35  }, ":focus-visible matches after accesskey on DIV after previous mouse focus");
     36 
     37  promise_test(async t => {
     38    await test_driver.click(initial);
     39    assert_equals(getComputedStyle(initial).outlineStyle, "none", `outline-style for ${initial.tagName}#${initial.id} should be none`);
     40 
     41    await pressAccessKey("b");
     42    assert_equals(getComputedStyle(targetB).outlineStyle, "solid", `outline-style for ${targetB.tagName}#${targetB.id} should be solid`);
     43    assert_equals(getComputedStyle(targetB).outlineColor, "rgb(0, 128, 0)", `outlineColor for ${targetB.tagName}#${targetB.id} should be green`);
     44    t.done();
     45  }, ":focus-visible matches after accesskey on BUTTON after previous mouse focus");
     46 </script>