Files
ladybird/Tests/LibWeb/Text/input/UIEvents/KeyEvent-functional-keys.html
Timothy Flynn 4fcaeabe1a LibWeb+UI: Detect and handle left vs. right modifier keys
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).
2024-10-09 19:10:02 +02:00

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>