scroll-state-scrollable-layout-change-002.html (1388B)
1 <!DOCTYPE html> 2 <title>@container: scroll-state(scrollable) layout change removing vertical scrollbar</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#scrollable"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script> 7 <script src="/css/css-transitions/support/helper.js"></script> 8 <style> 9 #scroller { 10 container-type: scroll-state; 11 overflow: auto; 12 width: 100px; 13 height: 100px; 14 } 15 #target { 16 --scrollable: no; 17 @container scroll-state(scrollable) { 18 --scrollable: yes; 19 } 20 } 21 #filler { 22 height: 2000px; 23 } 24 </style> 25 <div id="scroller"> 26 <div id="target"></div> 27 <div id="filler"></div> 28 </div> 29 <script> 30 setup(() => assert_implements_scroll_state_container_queries()); 31 32 promise_test(async t => { 33 await waitForAnimationFrames(2); 34 assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "yes"); 35 }, "Check scroll-state(scrollable) initially matching"); 36 37 promise_test(async t => { 38 filler.style.height = "0px"; 39 await waitForAnimationFrames(2); 40 assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "no"); 41 }, "Check scroll-state(scrollable) not matching after layout change no longer causing vertical overflow"); 42 43 </script>