tor-browser

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

focus-scroll-under-delegatesFocus.html (1239B)


      1 <!DOCTYPE html>
      2 <link rel="author" href="mailto:masonf@chromium.org">
      3 <link rel="help" href="https://issues.chromium.org/issues/324112201">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-actions.js"></script>
      8 <script src="/resources/testdriver-vendor.js"></script>
      9 
     10 <div id=container style="border:1px solid red; width: 100px;">
     11  <template shadowrootmode=open shadowrootdelegatesfocus>
     12    <slot></slot>
     13  </template>
     14 
     15  <a id=anchor href="#heading">anchor</a>
     16  <div style="height:2000px"></div>
     17  <h1 id=heading>Heading</h1>
     18 </div>
     19 
     20 <script>
     21 promise_test(async (t) => {
     22  t.add_cleanup(() => container.remove());
     23  let scrolled = new Promise(resolve => {
     24    document.addEventListener('scrollend',resolve,{once:true});
     25  })
     26  await test_driver.click(anchor);
     27  await scrolled;
     28 
     29  scrolled = false;
     30  document.addEventListener('scroll',() => {
     31    scrolled = true;
     32  });
     33  await test_driver.click(heading);
     34  await new Promise(resolve => t.step_timeout(resolve, 500));
     35  assert_false(scrolled,'The document should not scroll');
     36 },'delegatesFocus shouldn\'t cause extra focus steps');
     37 </script>