Skip to content

Commit 067751c

Browse files
committed
feat(user-input): support Tab to select resource in mention dropdown
1 parent d9a2d7f commit 067751c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/plus-menu-dropdown.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const PlusMenuDropdown = React.memo(
8181
e.preventDefault()
8282
const firstItem = contentRef.current?.querySelector<HTMLElement>('[role="menuitem"]')
8383
firstItem?.focus()
84-
} else if (e.key === 'Enter') {
84+
} else if (e.key === 'Enter' || e.key === 'Tab') {
8585
e.preventDefault()
8686
const first = filteredItemsRef.current?.[0]
8787
if (first) handleSelect({ type: first.type, id: first.item.id, title: first.item.name })
@@ -99,6 +99,12 @@ export const PlusMenuDropdown = React.memo(
9999
e.preventDefault()
100100
searchRef.current?.focus()
101101
}
102+
} else if (e.key === 'Tab') {
103+
const focused = document.activeElement as HTMLElement | null
104+
if (focused?.getAttribute('role') === 'menuitem') {
105+
e.preventDefault()
106+
focused.click()
107+
}
102108
}
103109
}, [])
104110

0 commit comments

Comments
 (0)