summaryrefslogtreecommitdiffstats
path: root/layout/generic/test/test_key_enter_prevent_default.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /layout/generic/test/test_key_enter_prevent_default.html
parentInitial commit. (diff)
downloadfirefox-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 'layout/generic/test/test_key_enter_prevent_default.html')
-rw-r--r--layout/generic/test/test_key_enter_prevent_default.html31
1 files changed, 31 insertions, 0 deletions
diff --git a/layout/generic/test/test_key_enter_prevent_default.html b/layout/generic/test/test_key_enter_prevent_default.html
new file mode 100644
index 0000000000..2d5793fe8f
--- /dev/null
+++ b/layout/generic/test/test_key_enter_prevent_default.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script>
+ SimpleTest.waitForExplicitFinish();
+ function runTest() {
+ const summary = document.querySelector("summary");
+ summary.addEventListener('click', function(e) {
+ // Prevent the details from toggling by key events.
+ e.preventDefault();
+ });
+ // Dispatch 'return' key to the summary element.
+ summary.focus();
+ synthesizeKey("KEY_Enter");
+
+ const details = document.querySelector("details");
+ ok(!details.open, "Prevent default on summary should not open details.");
+
+ SimpleTest.finish();
+ }
+ </script>
+</head>
+<body onload="runTest();">
+ <details>
+ <summary>Summary</summary>
+ <p>This is the details.</p>
+ </details>
+</body>
+</html>