Skip to content

fix: @ file mention picker cannot be closed by clicking outside#879

Merged
GCWing merged 1 commit into
GCWing:mainfrom
kev1n77:webui/dev
May 25, 2026
Merged

fix: @ file mention picker cannot be closed by clicking outside#879
GCWing merged 1 commit into
GCWing:mainfrom
kev1n77:webui/dev

Conversation

@kev1n77
Copy link
Copy Markdown
Collaborator

@kev1n77 kev1n77 commented May 25, 2026

Summary

The @ file mention picker (FileMentionPicker) could not be dismissed by clicking outside the popup. Users could only close it via Escape, selecting an item, or editor blur.

Fix

Added a document-level mousedown listener (capture phase) that closes the picker when the user clicks anywhere outside the container. Uses containerRef.current.contains() to avoid closing on clicks inside the picker.

Verification

  • pnpm run lint:web — passed
  • pnpm run type-check:web — passed

Add a document-level mousedown listener in FileMentionPicker that
closes the picker when the user clicks anywhere outside the container.
Previously the picker could only be dismissed via Escape, selecting an
item, or editor blur — clicking the surrounding area had no effect.

The listener uses capture phase to fire before editor blur handlers,
and a containership check to avoid closing on clicks inside the picker.
@GCWing GCWing merged commit 2068e4e into GCWing:main May 25, 2026
4 checks passed
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