else if (in.type == blink::WebInputEvent::Type::KeyUp)
dict.Set("type", "keyUp");
dict.Set("key", ui::KeycodeConverter::DomKeyToKeyString(in.domKey));
+ dict.Set("code",
+ ui::KeycodeConverter::DomCodeToCodeString(static_cast<ui::DomCode>(in.domCode)));
using Modifiers = blink::WebInputEvent::Modifiers;
dict.Set("isAutoRepeat", (in.modifiers & Modifiers::IsAutoRepeat) != 0);
* `input` Object - Input properties
* `type` String - Either `keyUp` or `keyDown`
* `key` String - Equivalent to [KeyboardEvent.key][keyboardevent]
+ * `code` String - Equivalent to [KeyboardEvent.code][keyboardevent]
* `isAutoRepeat` Boolean - Equivalent to [KeyboardEvent.repeat][keyboardevent]
* `shift` Boolean - Equivalent to [KeyboardEvent.shiftKey][keyboardevent]
* `control` Boolean - Equivalent to [KeyboardEvent.controlKey][keyboardevent]
w.webContents.once('before-input-event', (event, input) => {
assert.equal(input.type, opts.type)
assert.equal(input.key, opts.key)
+ assert.equal(input.code, opts.code)
assert.equal(input.isAutoRepeat, opts.isAutoRepeat)
assert.equal(input.shift, opts.shift)
assert.equal(input.control, opts.control)
return testBeforeInput({
type: 'keyDown',
key: 'A',
+ code: 'KeyA',
keyCode: 'a',
shift: true,
control: true,
return testBeforeInput({
type: 'keyUp',
key: '.',
+ code: 'Period',
keyCode: '.',
shift: false,
control: true,
return testBeforeInput({
type: 'keyUp',
key: '!',
+ code: 'Digit1',
keyCode: '1',
shift: true,
control: false,
return testBeforeInput({
type: 'keyUp',
key: 'Tab',
+ code: 'Tab',
keyCode: 'Tab',
shift: false,
control: true,