ssleptsov / ninja-keys

Keyboard shortcuts interface for your website. Working with static HTML, Vanilla JS, Vue, React, Svelte.
https://ninja-keys-demo.vercel.app/
MIT License
1.65k stars 60 forks source link

feature request: prevent open event via listener or callback #13

Open viglucci opened 2 years ago

viglucci commented 2 years ago

Is there currently a way to prevent the menu from opening when the hotkey (ctrl + k) is invoked?

I have a scenario where the component which mounts the ninja-key element has an initial loading state, and I would like to be able to prevent the command menu from opening while in the loading state.

Thanks

ssleptsov commented 2 years ago

Right now no. But that sounds as a good feature, I will add "enabled/disabled" property Thanks!

viglucci commented 2 years ago

Thanks!

One quick question: will the enabled/disabled property also prevent the children hotkeys from invoking as well? I think if enabled: false is set, then ctrl + h (home) should also be disabled, but just wanted to clarify what your thoughts were.

Thanks again

ssleptsov commented 2 years ago

Yeah, sure. It will disable/enable all hotkeys too based on that property