gecko-dev/layout/reftests/details-summary/key-enter-single-summary.html
Ting-Yu Lin 22224242ba Bug 1249556 - Implement toggling details by keyboard. r=smaug
The user can switch to the main <summary> by tab key, and toggle the
<details> by either 'space' key or 'enter' key.

'return' key is handled with 'keypress', and the 'space' key is handled
with 'keyup' like the HTMLInputElement.

MozReview-Commit-ID: HE6IduUGCpj

--HG--
extra : rebase_source : 34598d95f35bf6b5bd927457ee09e42eb6ec0a68
2016-03-19 20:37:09 +08:00

21 lines
601 B
HTML

<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html class="reftest-wait">
<script>
function runTest() {
var summary = document.getElementById("summary");
// Dispatch 'return' key to the summary element.
summary.dispatchEvent(new KeyboardEvent("keypress", {"keyCode": 13}));
document.documentElement.removeAttribute("class");
}
</script>
<body onload="runTest();">
<details>
<summary id="summary">Summary</summary>
<p>This is the details.</p>
</details>
</body>
</html>