targeted-column-scroll-marker-selection-001.html (3002B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 4 <head> 5 <meta charset="utf-8"> 6 <title>CSS Test: scroll tracking for ::scroll-markers whose orignatin elements cannot be scroll-aligned </title> 7 <link rel="match" href="targeted-column-scroll-marker-selection-001-ref.html"> 8 <link rel="help" href="https://drafts.csswg.org/css-overflow-5/#scroll-container-scroll"> 9 <script src="/css/css-transitions/support/helper.js"></script> 10 <script src="/dom/events/scrolling/scroll_support.js"></script> 11 <script src="/common/reftest-wait.js"></script> 12 </head> 13 14 <body> 15 <style> 16 .wrapper { 17 display: grid; 18 justify-content: center; 19 } 20 21 .carousel { 22 width: 800px; 23 height: 200px; 24 overflow-x: scroll; 25 scroll-snap-type: x mandatory; 26 list-style-type: none; 27 scroll-behavior: smooth; 28 border: solid 2px grey; 29 padding-top: 10%; 30 text-align: center; 31 counter-set: markeridx -1; 32 columns: 2; 33 34 &::column::scroll-marker { 35 content: counter(markeridx); 36 counter-increment: markeridx; 37 align-content: center; 38 text-align: center; 39 width: 35px; 40 height: 35px; 41 border-radius: 50%; 42 margin: 3px; 43 background-color: red; 44 } 45 &::column::scroll-marker:target-current { 46 background-color: green; 47 } 48 &>.item { 49 scroll-snap-align: center; 50 height: 80%; 51 width: 158px; 52 border: 1px solid; 53 place-content: center; 54 display: inline-block; 55 } 56 57 scroll-marker-group: after; 58 59 &::scroll-marker-group { 60 height: 45px; 61 display: flex; 62 align-items: center; 63 justify-content: center; 64 border: solid 1px black; 65 border-radius: 30px; 66 } 67 } 68 </style> 69 <div class="wrapper" id="wrapper"> 70 <div class="carousel" id="carousel"> 71 <div class="item item0" tabindex=0>0</div> 72 <div class="item item1" tabindex=0>1</div> 73 <div class="item item2" tabindex=0>2</div> 74 <div class="item item3" tabindex=0>3</div> 75 <div class="item item4" tabindex=0>4</div> 76 <div class="item item5" tabindex=0>5</div> 77 <div class="item item6" tabindex=0>6</div> 78 <div class="item item7" tabindex=0>7</div> 79 <div class="item item8" tabindex=0>8</div> 80 <div class="item item9" tabindex=0>9</div> 81 <div class="item item10" tabindex=0>10</div> 82 <div class="item item11" tabindex=0>11</div> 83 <div class="item item12" tabindex=0>12</div> 84 <div class="item item13" tabindex=0>13</div> 85 <div class="item item14" tabindex=0>14</div> 86 <div class="item item15" tabindex=0>15</div> 87 </div> 88 </div> 89 <script> 90 91 const items = document.querySelectorAll(".item"); 92 function runTest() { 93 const item2 = items[2]; 94 item2.scrollIntoView(); 95 waitForAnimationFrames(2).then(() => { 96 takeScreenshot(); 97 }); 98 } 99 waitForCompositorReady().then(runTest); 100 </script> 101 </body> 102 103 </html>