Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/forms/the-textarea-element/textarea-pagedown-selection.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>PageDown moves the caret inside the textarea even if not scrollable</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div style="height:200vh">
<textarea id="t" style="height:10em;">foo
bar
baz
</textarea>
</div>
<script>
promise_test(async () => {
t.focus();
t.setSelectionRange(0, 0);
SpecialPowers.doCommand(window, "cmd_movePageDown");
assert_equals(t.selectionStart, t.value.length,
"caret should move to the end within the textarea");
assert_equals(t.selectionEnd, t.value.length,
"selection should stay collapsed at the new caret position");
assert_equals(window.scrollY, 0, "the root should not have scrolled");
}, "PageDown moves the caret inside the textarea even if not scrollable");
</script>