scroll-marker-navigation-cycles.html (1813B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Test: ::scroll-marker key navigation cycles</title> 4 <link rel="help" href="https://drafts.csswg.org/css-overflow-5/#scroll-marker-pseudo"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-actions.js"></script> 10 <script src="/resources/testdriver-vendor.js"></script> 11 <style> 12 body { 13 margin: 0; 14 } 15 16 #scroller { 17 overflow: auto; 18 width: 100px; 19 height: 100px; 20 scroll-marker-group: before; 21 white-space: nowrap; 22 } 23 24 #scroller::scroll-marker-group { 25 display: flex; 26 height: 10px; 27 width: 30px; 28 } 29 30 #scroller div { 31 background: blue; 32 display: inline-block; 33 height: 100px; 34 width: 100px; 35 } 36 37 #scroller div::scroll-marker { 38 content: ""; 39 background: blue; 40 width: 10px; 41 height: 10px; 42 } 43 44 #scroller div::scroll-marker:target-current { 45 background: green; 46 } 47 </style> 48 <div id="scroller"> 49 <div id="first_item"></div> 50 <div></div> 51 <div id="last_item"></div> 52 </div> 53 <script> 54 promise_test(async t => { 55 await new test_driver.Actions() 56 .pointerMove(5, 5) 57 .pointerDown() 58 .pointerUp() 59 .send(); 60 assert_equals(getComputedStyle(first_item, "::scroll-marker").backgroundColor, "rgb(0, 128, 0)", "first ::scroll-marker gets activated upon clicking"); 61 await new test_driver.Actions() 62 .keyDown('\uE012') 63 .keyUp('\uE012') 64 .send(); 65 assert_equals(getComputedStyle(last_item, "::scroll-marker").backgroundColor, "rgb(0, 128, 0)", "last ::scroll-marker gets activated by going from the first one"); 66 }); 67 </script>