Skip to content

fix: dismiss composer mention popovers - #156

Merged
morgmart merged 4 commits into
mainfrom
dismiss-composer-popover
Aug 21, 2026
Merged

fix: dismiss composer mention popovers#156
morgmart merged 4 commits into
mainfrom
dismiss-composer-popover

Conversation

@morgmart

Copy link
Copy Markdown
Collaborator

Category: fix
User Impact: Users can dismiss mention suggestions with Escape or by clicking elsewhere, then continue writing without the suggestions reopening for the same reference.

Problem: Mention suggestions could remain in the way when text such as a Datadog query contained @, with no reliable way to leave the suggestion mode. Closing the menu also needed to avoid immediately reopening it as the user continued typing the same token.

Solution: Let the shared popover primitive own Escape and outside-click dismissal, while mention state remembers the dismissed token until the user starts a genuinely new reference or draft. The behavior is applied consistently to both composer surfaces and covered by interaction and state-lifecycle tests.

File changes

src/features/chat/hooks/useMentionHandlers.ts
Passes the current draft into mention detection and exposes the explicit dismissal action to composer surfaces.

src/features/chat/ui/ChatInput.tsx
Uses the controlled Popover dismissal lifecycle for outside clicks and routes Escape through the same mention dismissal behavior.

src/features/chat/ui/MentionAutocomplete.tsx
Removes document-level pointer and Escape handling so this component only renders and manages suggestion presentation.

src/features/chat/ui/mentionDetection.ts
Tracks intentionally dismissed mention tokens, keeps them dismissed during continued typing, and resets suppression for replacement tokens or externally changed drafts.

src/shared/ui/GlobalComposerPill.tsx
Applies the same Popover-owned dismissal behavior to the global composer.

src/features/chat/ui/tests/ChatInput.test.tsx
Covers composer-click dismissal, continued typing after Escape, and opening suggestions in a new draft.

src/features/chat/ui/tests/MentionAutocomplete.test.tsx
Removes interaction tests for behavior that is no longer owned by the presentation component.

src/features/chat/ui/tests/mentionDetection.test.ts
Covers same-token suppression, replacement tokens, and the distinction between dismissal and normal closure.

@morgmart
morgmart requested a review from a team August 20, 2026 23:38
@kalvinnchau kalvinnchau changed the title dismiss composer mention popovers fix: dismiss composer mention popovers Aug 20, 2026
kalvinnchau
kalvinnchau previously approved these changes Aug 20, 2026
@morgmart
morgmart merged commit 0f59bcd into main Aug 21, 2026
8 checks passed
@morgmart
morgmart deleted the dismiss-composer-popover branch August 21, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants