Modeler specific Hotkeys

Hello,
binding of the keyboard seems to work only for the document (followed Hotkeys like the demo?); so config like so: { keyboard: { bindTo: document },
but i can’t bind it only for a modeler element, as hotkeys stop working …
so { keyboard: { bindTo: document.getElementById(“modeler”) }, - i assume this should be working though to be able copy/paste normally outside of the editor ?
Thanks!

Our keyboard events oblige to the standard ways of keyboard event handling in the browser: We can only capture events, if the element has keyboard focus (and is keyboard focusable in the first place).

The document target is a safe choice, as every keyboard event does eventually bubble up, unless being stopped. If you go for anything else, please make sure that the element (or one of its children) have keyboard focus. Otherwise shortcuts won’t work.

On a site-note, you can also implement keyboard handling yourself entirely and resort to our editorActions interface or the core modeling API to trigger user actions.

1 Like