scroll-markers-focus-active-element.html (1576B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Test: document.activeElement for ::scroll-marker is scroller</title> 4 <link rel="help" 5 href="https://github.com/flackr/carousel/tree/main/scroll-marker#what-is-the-documentactiveelement-of-a-focused-pseudo-element"> 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 width: 600px; 18 height: 300px; 19 overflow: auto; 20 scroll-marker-group: before; 21 white-space: nowrap; 22 } 23 24 #scroller div { 25 background: green; 26 display: inline-block; 27 width: 600px; 28 height: 270px; 29 } 30 31 #scroller :first-child { 32 background: purple; 33 } 34 35 #scroller::scroll-marker-group { 36 display: flex; 37 height: 20px; 38 width: 40px; 39 } 40 41 #scroller div::scroll-marker { 42 content: ""; 43 width: 100px; 44 height: 20px; 45 background-color: blue; 46 display: inline-block; 47 } 48 49 #scroller div:first-of-type::scroll-marker { 50 background-color: brown; 51 } 52 </style> 53 <div id="scroller"> 54 <div></div> 55 <div></div> 56 </div> 57 <script> 58 promise_test(async t => { 59 actions_promise = new test_driver.Actions() 60 .pointerMove(15, 15) 61 .pointerDown() 62 .pointerUp() 63 .send(); 64 await actions_promise; 65 assert_equals(document.activeElement, scroller, "document.activeElement for ::scroll-marker is scroller"); 66 }); 67 </script>