diff --git a/src/lib/actions/keybind.ts b/src/lib/actions/keybind.ts index 05e06e5..e57c974 100644 --- a/src/lib/actions/keybind.ts +++ b/src/lib/actions/keybind.ts @@ -6,8 +6,11 @@ type Options = { }; export function keybind(node: HTMLElement, options: Options) { - const mousetrap = new Mousestrap(document.getElementsByTagName("main")[0]); + console.debug("[keybind] binding:", options.keys); + + const mousetrap = new Mousestrap(document.documentElement); mousetrap.bind(options.keys, () => { + console.debug("[keybind] handling:", options.keys); options.f(); // Always prevent default behavior @@ -16,6 +19,7 @@ export function keybind(node: HTMLElement, options: Options) { return { destroy() { + console.debug("[keybind] destorying:", options.keys); mousetrap.reset(); } };