Select to view content in your preferred language

Intercepting/changing keyboard events when using Sketch

330
1
10-18-2023 11:42 AM
ToddRunstein
Emerging Contributor

We're using the Sketch tool and would like to change the behavior of some keyboard events, specifically the "escape" key while in create mode. I haven't been able to find anything in the docs, so I'm not sure how to proceed. To be clear, waiting for the "cancel" event is too late for our use case - we want to be able to modify what happens when "escape" (or another key) are pressed.

Though I haven't tried it, it seems like adding a listener on the MapView to essentially intercept the keypress might work? But to be honest, I'm hoping I'm missing a more obvious approach. Any suggestions or ideas are welcome!

Tags (1)
0 Kudos
1 Reply
ToddRunstein
Emerging Contributor

Just in case anyone else wants/needs to change the keypress events sent to Sketch, I can confirm that adding a listener on the MapView's "key-down" event let's you `stopPropogation`, or whatever you may wish to do. Hopefully someone else will find this useful.