Skip to content
Discussion options

You must be logged in to vote

In cases where we need a global shortcut that will work in all inputs, we use manual event listeners. The code might look a bit like:

import{eventToHotkeyString}from'@github/hotkey'constGLOBAL_HOTKEY='Cmd+K'document.addEventListener('keydown',(event)=>{lethotkeyString=eventToHotkeyString(event)if(!hotkeyString)returnif(hotkeyString!==GLOBAL_HOTKEY)returnrunGlobalHotkeyCommand()})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected bykeithamus
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@sethhorsley@keithamus
Converted from issue

This discussion was converted from issue #83 on March 06, 2023 11:13.