mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-09 18:15:19 +00:00
Our handling of left vs. right modifiers keys (shift, ctrl, etc.) was largely not to spec. This patch adds explicit UIEvents::KeyCode values for these keys, and updates the UI to match native key events to these keys (as best as we are able).
33 lines
698 B
HTML
33 lines
698 B
HTML
<input id="input" />
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
const FUNCTIONAL_KEYS = [
|
|
"CapsLock",
|
|
"Escape",
|
|
"Return",
|
|
"Space",
|
|
"Tab",
|
|
"LeftAlt",
|
|
"RightAlt",
|
|
"LeftControl",
|
|
"RightControl",
|
|
"LeftShift",
|
|
"RightShift",
|
|
"LeftSuper",
|
|
"RightSuper",
|
|
];
|
|
|
|
test(() => {
|
|
let input = document.getElementById("input");
|
|
|
|
input.addEventListener("keydown", e => {
|
|
println(`key=${e.key} code=${e.code}`);
|
|
e.preventDefault();
|
|
});
|
|
|
|
FUNCTIONAL_KEYS.forEach(key => {
|
|
internals.sendKey(input, key);
|
|
});
|
|
});
|
|
</script>
|