bpmn-js/test/util/KeyEvents.js
Maciej Barelkowski f0610721c9 feat(keyboard): use key value for bindings
`KeyboardEvent.keyCode` is deprecated, so the BpmnKeyBindings will
use non-deprecated `KeyboardEvent.key` instead.
2018-10-29 14:52:41 +00:00

11 lines
240 B
JavaScript

export function createKeyEvent(element, key, ctrlKey) {
var e = document.createEvent('Events') || new document.defaultView.CustomEvent('keyEvent');
e.key = key;
e.keyCode = key;
e.which = key;
e.ctrlKey = ctrlKey;
return e;
}