Skip to content

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Oct 11, 2025

Description

This PR attempts to address Issue #8615. Feedback and guidance are welcome.

When the autocomplete menu opens (for @ mentions or / commands), items under the mouse cursor would be automatically highlighted even without any mouse movement. This caused the wrong item to be selected when pressing Enter, as reported in the issue.

Problem

  • Mouse cursor position was causing immediate item highlighting on menu open
  • No distinction between intentional hover (mouse movement) and accidental positioning
  • Different behavior from VS Code's standard autocomplete (e.g., Ctrl+P)

Solution

Added mouse movement tracking to the ContextMenu component:

  • New hasMouseMoved state tracks whether the mouse has actually moved
  • Items only highlight on hover after mouse movement is detected
  • State resets when menu changes (new search query)

Testing

  1. Type @ or / in the chat input
  2. Position mouse over where autocomplete items will appear before typing
  3. Verify that no item is highlighted until you move the mouse
  4. Move mouse slightly and verify hover highlighting now works normally

Checklist

  • Code follows project conventions
  • All tests pass (1094 tests passed)
  • Linting passes
  • Type checking passes

Fixes #8615


Important

Fixes autocomplete highlighting issue by tracking mouse movement in ContextMenu.tsx.

  • Behavior:
    • Fixes issue where autocomplete items were highlighted without mouse movement in ContextMenu.tsx.
    • Introduces hasMouseMoved state to track mouse movement.
    • Items only highlight after mouse movement is detected.
    • Resets hasMouseMoved state when menu changes (new search query).
  • Functions:
    • Adds handleMouseMove() to update hasMouseMoved state.
    • Modifies onMouseEnter to check hasMouseMoved before highlighting items.

This description was created by Ellipsis for 1988a3e. You can customize this summary. It will automatically update as commits are pushed.

- Added hasMouseMoved state to track actual mouse movement
- Only allow hover highlighting after mouse has moved
- Reset mouse movement tracking when menu changes (new search)
- Fixes issue where autocomplete would highlight items under cursor on open

Fixes #8615
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 11, 2025 23:50
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Oct 11, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] Accidentally leaving the mouse over autocomplete items highlights them

2 participants