2 Replies
Hi @reina. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The Nuxt UI composable
defineShortcuts
allows you to define keyboard shortcuts using a specific format. For key combinations, you should use underscores (_
) to separate the keys. For example, to define a shortcut for "Alt + S", you should use 'alt_s'
as the key in your shortcut configuration:
If "Alt + S" is not working, here are a few things to check based on the documentation:
1. Correct Key Name: Make sure you are using 'alt_s'
(all lowercase) as the shortcut key. The documentation specifies that the key should be written in lowercase and should match the KeyboardEvent.key
values.
2. Input Focus: By default, shortcuts only trigger when no input is focused. If you want the shortcut to work even when an input is focused, use the usingInput
option:
3. Platform Differences: The documentation notes that meta
is automatically mapped to Ctrl
on non-macOS platforms, but alt
should work as is.
4. Browser/OS Limitations: Some key combinations (like Alt + S) may be reserved or behave differently in certain browsers or operating systems, which could prevent your handler from firing.
If you have followed the above and it still doesn't work, the knowledge sources do not provide further troubleshooting steps for this specific issue. You may want to check your browser's developer tools for any event conflicts or test with a different key combination to verify that defineShortcuts
is working in your environment.
For more details, see the official documentation: defineShortcuts composable<source>https://ui.nuxt.com/composables/define-shortcuts</source.>
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@516186529547288576> Kapa.ai is still learning and improving, please let me know how I did by reacting below.