feat(ui): update context menu#4362
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@BugBot review |
PR SummaryMedium Risk Overview Adds a new mention-driven resource picker mode: typing Extends the shared Reviewed by Cursor Bugbot for commit e6e091b. Bugbot is set up for automated code reviews on this repo. Configure here. |
Resolved conflicts: - user-input.tsx: kept HEAD's mention-menu logic (syncMentionState, mentionRangeRef, useCallback handleInputChange) over staging's simplified inline handleInputChange - short-input.tsx: kept HEAD's selection:text-transparent fix from #4318 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Programmatic plusMenuRef.close() sets the dropdown's internal open=false but Radix doesn't fire onOpenChange for controlled changes, so handlePlusMenuClose never ran and mentionRangeRef stayed truthy after submitting a message with an active @mention. That caused the keydown handler to keep intercepting ArrowUp/ArrowDown/Tab post-submit, breaking the "edit last queued message" ArrowUp shortcut until the user typed again. Clear mentionRangeRef and mentionQuery inline alongside the close() call. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR redesigns the context menu for copilot/mothership inputs: the paperclip attachment action moves to its own standalone
Confidence Score: 3/5Two P1 logic bugs in the new mention flow should be fixed before merging. Two P1 findings present: folder items leaking into the mention list, and Enter submitting the form while a highlighted mention item is visible. Both affect the primary new feature added in this PR. plus-menu-dropdown.tsx (folder filter in mention mode) and user-input.tsx (Enter key handling in mention block) Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User (textarea)
participant UI as UserInput
participant PM as PlusMenuDropdown
U->>UI: type "@foo"
UI->>UI: handleInputChange -> syncMentionState
UI->>UI: mentionRangeRef = {start, end}
UI->>PM: open(anchor, {mention: true})
PM->>PM: isMention=true, onOpenAutoFocus prevented
Note over PM: Focus stays in textarea
U->>UI: ArrowDown / ArrowUp
UI->>PM: moveActive(+-1)
PM->>PM: setActiveIndex
U->>UI: Tab
UI->>PM: selectActive()
PM->>UI: onResourceSelect({type, id, title})
UI->>UI: replace mentionRange with @Title
UI->>UI: mentionRangeRef=null, setMentionQuery(null)
U->>UI: Enter (no mention guard)
UI->>UI: handleSubmit() -- dropdown still open!
U->>UI: Paperclip button click
UI->>UI: handleFileSelectStable()
Reviews (1): Last reviewed commit: "fix(user-input): clear mention state on ..." | Re-trigger Greptile |
Long resource names were truncating in a 320px-wide menu. Bump to 420px and cap with max-w on viewport so it can't overflow on small screens. Overrides the emcn DropdownMenuContent's default max-w-[220px] via twMerge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
420px felt too wide; 360px gives long resource names enough room without dominating the input area. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3087995. Configure here.
- 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>

Summary
Change context menu for copilot/mothership inputs.
Type of Change
Testing
Checklist
Screenshots/Videos