Adding keyboard shortcut for panel app?

Hi,

I would like to add keyboard shortcuts to my panel app but am not sure how to proceed. I basically have a button already in my app and I would like the user to be able to press the “p” key on the keyboard to use that button instead to clicking with the mouse.

It sounds like I would need to add some javascript components but what I have tried so far hasn’t been successful ;-(.

Has anyone tried to do this already? Any tips on how I could tackle this?

I am not sure if this is helpful but the code I am working on is at the link below and the button I want the shortcut is called “play_sound_button” :

Any help would really appreciated

Best,
Xavier

Maybe take a look at the examples in Can panel implement keyboard hotkeys? · Issue #3193 · holoviz/panel · GitHub