Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: set modifiersKey to be alt, meta, crtl and tab

Pedro Vítor Ribeiro Martins02fd34ec3269
diff --git a/packages/ui/src/components/Command/Command.utils.tsx b/packages/ui/src/components/Command/Command.utils.tsx
index 809b4273c7c..8bff8b8d96d 100644
--- a/packages/ui/src/components/Command/Command.utils.tsx
+++ b/packages/ui/src/components/Command/Command.utils.tsx
@@ -408,8 +408,10 @@ export function useAutoInputFocus() {
// Focus the input when typing from anywhere
React.useEffect(() => {
- function isModifierNotShift(event: KeyboardEvent) {
- return event.key.length !== 1 && event.key !== 'Shift'
+ function isModifierKey(event: KeyboardEvent) {
+ const modifierKeys = ['Alt', 'Control', 'Meta', 'Tab']
+ const { key } = event
+ return modifierKeys.includes(key)
}
// Keep track of whether the modifier key (except shift) is pressed
@@ -417,7 +419,7 @@ export function useAutoInputFocus() {
function onKeyDown(event: KeyboardEvent) {
// If the user is typing a modifier key, don't focus the input and set the modifierPressed flag
- if (isModifierNotShift(event)) {
+ if (isModifierKey(event)) {
modifierPressed = true
} else {
if (!modifierPressed) {
@@ -428,7 +430,7 @@ export function useAutoInputFocus() {
}
function onKeyUp(event: KeyboardEvent) {
console.log('keyup')
- if (isModifierNotShift(event)) {
+ if (isModifierKey(event)) {
// Reset the modifierPressed flag when the modifier key is released
modifierPressed = false
}