Skip to content

Commit e6e091b

Browse files
address greptile review on PR #4362
- plus-menu-dropdown: drop folder type from the flat mention list (folders organize resources but aren't an insertable mention target — the nested rendering already excludes them). - user-input: fold Enter into the mention-mode keydown guard so Enter confirms the highlighted resource instead of submitting the form. Falls through to the normal Enter-submit path when no match is highlighted (Tab keeps prior behavior). - dropdown-menu wrapper: drop the misleading cast on the spread — runtime accepts onOpenAutoFocus regardless and the cast was hiding any future props added to DropdownMenuContentProps. - plus-menu-dropdown: trim mention-mode + submenu widths to 300px (320px clipped on the narrower copilot panel). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 498a68f commit e6e091b

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ export const PlusMenuDropdown = React.memo(
8080
const q = rawQuery.toLowerCase().trim()
8181
// In mention mode always render a flat filtered list — empty query = show everything.
8282
if (!isMention && !q) return null
83+
// Folders organize resources but aren't a valid mention/insertable target — drop them
84+
// from the flat list (matches the nested rendering, which also excludes them).
85+
const flatGroups = availableResources.filter(({ type }) => type !== 'folder')
8386
if (isMention && !q) {
84-
return availableResources.flatMap(({ type, items }) =>
85-
items.map((item) => ({ type, item }))
86-
)
87+
return flatGroups.flatMap(({ type, items }) => items.map((item) => ({ type, item })))
8788
}
88-
return availableResources.flatMap(({ type, items }) =>
89+
return flatGroups.flatMap(({ type, items }) =>
8990
items.filter((item) => item.name.toLowerCase().includes(q)).map((item) => ({ type, item }))
9091
)
9192
}, [isMention, mentionQuery, search, availableResources])

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,13 @@ export const UserInput = forwardRef<UserInputHandle, UserInputProps>(function Us
494494
plusMenuRef.current?.moveActive(-1)
495495
return
496496
}
497-
if (e.key === 'Tab' && !e.shiftKey) {
498-
e.preventDefault()
499-
if (plusMenuRef.current?.selectActive()) return
500-
return
497+
if ((e.key === 'Tab' || e.key === 'Enter') && !e.shiftKey) {
498+
// Confirm the highlighted match if there is one. If no items match, fall
499+
// through so Enter still submits and Tab still does its default thing.
500+
if (plusMenuRef.current?.selectActive()) {
501+
e.preventDefault()
502+
return
503+
}
501504
}
502505
}
503506

apps/sim/components/emcn/components/dropdown-menu/dropdown-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const DropdownMenuContent = React.forwardRef<
111111
'z-[var(--z-dropdown)] max-h-[240px] min-w-[8rem] max-w-[220px] origin-[--radix-dropdown-menu-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-lg border border-[var(--border)] bg-[var(--bg)] p-1.5 text-[var(--text-body)] shadow-sm',
112112
className
113113
)}
114-
{...(props as React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>)}
114+
{...props}
115115
/>
116116
</DropdownMenuPrimitive.Portal>
117117
))

0 commit comments

Comments
 (0)