| <!DOCTYPE html> |
| <title>@container: scroll-state(scrollable) layout change removing vertical scrollbar</title> |
| <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#scrollable"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script> |
| <script src="/css/css-transitions/support/helper.js"></script> |
| <style> |
| #scroller { |
| container-type: scroll-state; |
| overflow: auto; |
| width: 100px; |
| height: 100px; |
| } |
| #target { |
| --scrollable: no; |
| @container scroll-state(scrollable) { |
| --scrollable: yes; |
| } |
| } |
| #filler { |
| height: 2000px; |
| } |
| </style> |
| <div id="scroller"> |
| <div id="target"></div> |
| <div id="filler"></div> |
| </div> |
| <script> |
| setup(() => assert_implements_scroll_state_container_queries()); |
| |
| promise_test(async t => { |
| await waitForAnimationFrames(2); |
| assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "yes"); |
| }, "Check scroll-state(scrollable) initially matching"); |
| |
| promise_test(async t => { |
| filler.style.height = "0px"; |
| await waitForAnimationFrames(2); |
| assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "no"); |
| }, "Check scroll-state(scrollable) not matching after layout change no longer causing vertical overflow"); |
| |
| </script> |