-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: accidentally leaving the mouse over autocomplete items highlights them #9087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: accidentally leaving the mouse over autocomplete items highlights them #9087
Conversation
context menu Improve the context menu UX by separating hover and selection visual states. Previously, hovering would immediately change the selected index, making it difficult to distinguish between the actively selected item and the item being hovered over. Changes: - Add separate hoveredIndex state to track mouse hover independently from selection - Apply different background colors for hover vs selection states - Update mouse event handlers to properly manage hover state - Reset hover state when search query changes
Review complete. No issues found. This PR successfully separates hover and selection states in the context menu, preventing mouse hover from interfering with keyboard navigation. The implementation correctly mimics VSCode's Quick Open behavior. Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Review complete. No issues found. This PR successfully separates hover and selection states in the context menu, preventing mouse hover from interfering with keyboard navigation. The implementation correctly mimics VSCode's Quick Open behavior where keyboard and mouse interactions are independent. Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Related GitHub Issue
Closes: #8615
Description
This PR separates hover state from keyboard selection state in the context menu autocomplete to prevent mouse hover from interfering with keyboard navigation.
Key implementation details:
hoveredIndexstate separate fromselectedIndexto track mouse hover independentlyselectedIndexis now only updated by keyboard navigation and onClick eventshoveredIndexis updated by onMouseEnter/onMouseLeave for visual hover feedbackDesign rationale:
I implemented this to exactly mimic VSCode's Quick Open/Command Palette behavior, where:
Test Procedure
Manual testing steps:
@in the chat inputExpected behavior:
This matches the exact behavior of VSCode's native Quick Open (Ctrl+P) and Command Palette (Ctrl+Shift+P) menus.
Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
Get in Touch
Discord:
@ocean.smithImportant
Separates hover and selection states in
ContextMenu.tsxto prevent mouse hover from interfering with keyboard navigation.hoveredIndexstate inContextMenu.tsxto track mouse hover separately fromselectedIndex.selectedIndexupdated only by keyboard andonClickevents.hoveredIndexupdated byonMouseEnter/onMouseLeavefor hover feedback.ContextMenu.tsx.This description was created by
for eac11c1. You can customize this summary. It will automatically update as commits are pushed.