Disable backspace hotkey in text fields

Is it possible to change the default hotkeys? I am trying to use the backspace in a text field for my annotation but it is linked to the undo button.

Thank you.

Not at the moment, but we’ve considered adding this!

And interesting, I thought I had this use case covered and Prodigy was already excluding inputs and textareas from the hotkey events. I’ll look into this again, this should definitely be the default behaviour.

In the meantime, you could probably do something like this as well and explicitly stop the keydown event on your input from propagating. You could even limit this to event.keyCode == 32 (space, or other keycodes).

document.addEventListener('prodigymount', event => {
    // wait until Prodigy has mounted
    var input = document.querySelector('.input');
    input.onkeydown = function(event) {
      // stop keydown event from propagating and triggering other actions

Thank you for the quick response.

I’m running into the same issue of not being able to use backspace in a text field since it’s linked to the undo button. I tried the javascript you suggested above, but prodigymount only seems to be firing once - i.e. when the page is first loaded - and not each time new data is streamed in. Because of this, the hotkeys are only disabled for the first annotation but not for each subsequent one. Any suggestions on how to handle this?

Thanks in advance!

@cpatino Yes, prodigymount is only called on mount. If you want to listen to every update to the content (e.g. changing task etc.), try prodigyupdate for now?

In the next release, the underlying problem should also be resolved and the hotkey shouldn’t trigger in inputs and textareas anymore.

Ah yes, prodigyupdate is what I was looking for. Thanks for the quick response!

1 Like