hotkey icon indicating copy to clipboard operation
hotkey copied to clipboard

Add support for global hotkeys

Open khanxmetu opened this issue 5 months ago • 1 comments

Problem Hotkeys do not trigger when the focused element is an input or textfield.

Suggestion Add opt in support for global hotkeys that fire even when focus is inside some input form/textarea. There are cases where certain shortcuts (e.g Ctrl+S to click save button, Ctrl+K to click a command palette) should work everywhere including when the user is typing in some textarea.

The feature is similar to Mousetrap’s Global Bind.

Possible Implementation

Introduce a data-hotkey-global attribute:

<button data-hotkey="Ctrl+s" data-hotkey-global>Save</button>

Related Work

https://github.com/github/hotkey/pull/48

khanxmetu avatar Aug 12 '25 12:08 khanxmetu

See Listen for some hotkeys on form fields #85 for a proposed approach for global hotkeys.

thibaudcolas avatar Sep 04 '25 15:09 thibaudcolas