Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-conditional/container-queries/scroll-state/scroll-direction-keyboard-scroll-on-body.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>@container: scroll-state(direction) keyboard scroll on body</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/web-animations/testcommon.js"></script>
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
<style>
html {
overflow: scroll;
}
body {
container-type: scroll-state;
overflow-y: scroll;
}
body {
height: 300px;
}
div {
height: 1000px;
--y: no;
}
@container scroll-state(direction: y) {
div {
--y: yes;
}
}
</style>
<body>
<div id="target"></div>
</body>
<script>
setup(() => assert_implements_scroll_state_container_queries());
promise_test(async t => {
await new test_driver.Actions()
.addPointer("TestPointer", "mouse")
.pointerMove(100, 100)
.pointerDown()
.pointerUp()
.send();
await new test_driver.Actions()
.keyDown('\uE00D')
.keyUp('\uE00D')
.send();
await new test_driver.Actions()
.keyDown('\uE00D')
.keyUp('\uE00D')
.send();
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--y"), "yes");
}, "Spacebar scroll on body");
</script>