diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/base/test/test_focus_scrollable_fieldset.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/test/test_focus_scrollable_fieldset.html')
-rw-r--r-- | dom/base/test/test_focus_scrollable_fieldset.html | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/dom/base/test/test_focus_scrollable_fieldset.html b/dom/base/test/test_focus_scrollable_fieldset.html new file mode 100644 index 0000000000..444d078cb1 --- /dev/null +++ b/dom/base/test/test_focus_scrollable_fieldset.html @@ -0,0 +1,60 @@ +<!doctype html> +<title>Test for bug 1351248</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script src="/tests/SimpleTest/EventUtils.js"></script> +<style> + fieldset { + overflow: auto; + height: 1em; + width: 1em; + } +</style> +<input type="text" id="start"> + +<fieldset> + <input type="text"> + <input type="text"> + <input type="text"> + <input type="text"> + <input type="text"> + <input type="text"> +</fieldset> + +<input type="text" id="end"> +<script> + SimpleTest.waitForExplicitFinish(); + SimpleTest.waitForFocus(async function() { + // Enable Full Keyboard Access emulation on Mac. + if (navigator.platform.indexOf("Mac") === 0) { + await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]}); + } + + const start = document.getElementById("start"); + + start.focus(); + + const end = document.getElementById("end"); + + is(document.activeElement, start, "Focus moved sanely"); + + let lastActiveElement = start; + let stack = [start]; + + do { + synthesizeKey("KEY_Tab"); + isnot(document.activeElement, lastActiveElement, "Focus should've moved once per tab keypress"); + lastActiveElement = document.activeElement; + stack.push(lastActiveElement); + } while (document.activeElement != end) + + is(stack.length, document.querySelectorAll("input").length + 1, "Fieldset should be focusable"); + + do { + let previous = stack.pop(); + is(document.activeElement, previous, "Focus should've moved backwards as expected"); + synthesizeKey("KEY_Tab", {shiftKey: true}); + } while (stack.length); + + SimpleTest.finish(); + }); +</script> |