Script: KeyPress Event for action execution

I don’t know if it is a simple question or not…

Can I make a script that binds to keyboard events for executing actions?

For example, just for understanding purposes… how would I display an alert(“you pressed space!”) if the user presses space on a doctype?


So far as I know you can trigger just when type in a field.
Maybe if you implement a jQuery in your app you can do something like that…

What’s the use case?

1 Like

I’d tackle this with the extend syntax:
frappe.ui.keys.extend(... and then you can add them. Careful about duplicate reserved key combinations with the browser.


Nice! :smiley:

1 Like

I would like to create some easy shortcuts for some things like pressing “quick entry” on journal entry… don’t know if is the best aproach, but it seems like it may be useful someday.

Really appreciate your help! Thanks @Leonardo_Augusto and @tmatteson!