fix(web): close slash and mention menus on click outside#948
Conversation
🦋 Changeset detectedLatest commit: 2f696e6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95e0184a95
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| watch(() => slashOpen.value || mentionOpen.value, (open) => { | ||
| if (open) { | ||
| document.addEventListener('click', onComposerDocClick, true); |
There was a problem hiding this comment.
Cancel pending mention lookups on outside clicks
When a user types @ and clicks the chat area before the 200 ms mention debounce fires, mentionOpen is still false, so this watcher has not installed the document click listener yet. The pending mentionTimer callback can then run after the composer has lost focus and set mentionOpen = true, leaving the mention menu open even though the user already clicked outside; the outside-close path needs to cancel pending mention work or listen while a mention search is pending.
Useful? React with 👍 / 👎.
95e0184 to
2f696e6
Compare
Closes #947
This PR closes the slash menu and
@mention menu when the user clicks outside the composer input area.What changed
cinWrapRefto the composer input wrapper..cin-wrapnow closes both menus, matching the behavior of other dropdowns in the composer (e.g., the permission dropdown).How to verify
/in the composer — the slash menu appears.@— the mention menu should also close on outside click.Esc, selecting an item, and submitting a message still close the menus as before.Notes
@moonshot-ai/kimi-web.