Can we add keyboard shortcuts for apps? | Community
Skip to main content

Can we add keyboard shortcuts for apps?

  • June 21, 2023
  • 3 replies
  • 0 views

Can Zendesk apps have their own custom keyboard shortcuts?

3 replies

Tipene
  • June 23, 2023

Hi Vincent,

Yes, this is possible using JavaScript in your app. Here's a basic example of how that can be accomplished:

document.addEventListener("keydown", (event) => {
if (event.code === "Space" || event.keyCode === 32) {
console.log("The Space bar was pressed");
}
});

This code will print the message to the browser console when the space bar is pressed. One thing to be aware of: the app will need to be in focus for the key press to be registered.

I hope this helps! Let me know if you have any questions.

Tipene


  • Author
  • June 26, 2023

If my app lives in the editor, wouldn’t this code only run after the button is clicked and the little modal pops up? I would like a shortcut that triggers the app so having the app listen to keydown events wouldn’t work. 


Tipene
  • June 27, 2023
Hey Vincent,

Thanks for the additional context.
 
I'm not aware of any events that allow the ticket_editor location to be programmatically opened unfortunately, so I don't think this will be possible. I think there is a case for something like this to be added though so I would encourage you to create a post in our feedback thread so our product team has visibility over this. Here's a link with more info on creating a feedback post:

https://support.zendesk.com/hc/en-us/community/posts/4408867934618-Product-feedback-guidelines-how-to-write-a-good-feedback-post

Sorry I couldn't be more help!

Tipene