tor-browser

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

scroll-target-padding-003.html (1850B)


      1 <!DOCTYPE html>
      2 <html>
      3 <title>focus() and scroll-padding with snapping off (y-axis)</title>
      4 <link rel='author' title='Elika J. Etemad' href='http://fantasai.inkedblade.net/contact'>
      5 <link rel='help' href='https://www.w3.org/TR/css-scroll-snap-1/#scroll-margin'>
      6 <link rel='match' href='scroll-target-001-ref.html'>
      7 <meta name='assert'
      8      content="Test passes if scroll-padding is honored
      9               on a scroll container with 'scroll-snap-type: none'
     10               when scrolling an element into view
     11               even if that operation is implied (in this case, by .focus()).">
     12 <style type='text/css'>
     13  .container {
     14    border: solid blue 4px;
     15    height: 4em;
     16    overflow: auto;
     17 
     18    /* to make failing more obvious */
     19    background: 0 1em / 100% 1em linear-gradient(red, red) repeat-x;
     20    /* avoid anti-aliasing issues */
     21    font: 20px/1 sans-serif;
     22    scrollbar-width: none;
     23  }
     24  .container > div, a {
     25    height: 1em;
     26    display: block;
     27    outline: none;
     28  }
     29  .container { scroll-padding: 2em 0 1em; } /* snap area is exact fit for snapport */
     30  #stripe    { background: green;         } /* color part of the snap area         */
     31  .fail      { color: red;                } /* make failing more obvious           */
     32 
     33  /* emulate `scrollbar-width: none` for browsers that don't support it yet */
     34  ::-webkit-scrollbar { display: none; }
     35 </style>
     36 
     37 <div id='instructions'>Test passes if there is a green stripe across the second quarter of the box below and no red.</div>
     38 
     39 <div class="container">
     40  <div></div>
     41  <div></div>
     42  <div></div>
     43  <div></div>
     44  <div class="fail">FAIL</div>
     45  <div></div>
     46  <div id="stripe"></div>
     47  <a href="" id="target"></a>
     48  <div></div>
     49  <div class="fail">FAIL</div>
     50  <div></div>
     51  <div></div>
     52  <div></div>
     53  <div></div>
     54 </div>
     55 
     56 <script>
     57  document.getElementById('target').focus();
     58 </script>