blog. Tags Atom Feed (.XML)

KeyboardEvent property viewer

#tool #web #web-apis

Recently I’d wanted to create a synthetic KeyboardEvent and I wanted to know what the fields look like… so here it is. The input here is listening for a keydown event, so you can just type a key into it and see what the resulting KeyboardEvent looks like.

element.dispatchEvent(new KeyboardEvent("keydown", {
key: "@", code: "Digit2", location: 0,
repeat: false, isComposing: false,
charCode: 0, keyCode: 50, which: 50,
ctrlKey: false, shiftKey: true, altKey: false, metaKey: false,
bubbles: true, cancelable: true, composed: true,
}));