diff --git a/src/use-hotkeys/use-hotkeys.ts b/src/use-hotkeys/use-hotkeys.ts index dfedba3c..e1864870 100644 --- a/src/use-hotkeys/use-hotkeys.ts +++ b/src/use-hotkeys/use-hotkeys.ts @@ -49,8 +49,10 @@ export class UseHotkeys extends StimulusUse { } unbind = () => { - for (const hotkey in this.hotkeysOptions.hotkeys as any) { - hotkeys.unbind(hotkey) + for (const [hotkey, definition] of Object.entries(this.hotkeysOptions.hotkeys as any)) { + const options = (definition as HotkeyDefinition).options + const scope = options.scope ? options.scope : '' + hotkeys.unbind(hotkey, scope) } }