fix(web): Fix duplicate highlight in composer slash command menu#1445
Open
AbdulelahHajjar wants to merge 1 commit intopingdotgg:mainfrom
Open
fix(web): Fix duplicate highlight in composer slash command menu#1445AbdulelahHajjar wants to merge 1 commit intopingdotgg:mainfrom
AbdulelahHajjar wants to merge 1 commit intopingdotgg:mainfrom
Conversation
Signed-off-by: Abdulelah Hajjar <aab.hajjar@gmail.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Four CSS-level changes in
ComposerCommandMenu.tsxto make theisActivestate the authoritative source of truth for item highlighting:autoHighlight={false}on theCommandcomponentdata-highlighted:bg-transparent data-highlighted:text-inheritto suppress Base UI's built-in highlight stylingbg-accent!/text-accent-foreground!soisActivealways wins overdata-highlightedwhen both are presentonMouseMovewith an!isActiveguard so that moving the mouse after keyboard navigation re-syncs the highlight to the hovered itemWhy
When navigating the slash command menu (
/,/model, etc..) with arrow keys, two items appear highlighted at the same time.This happens because Base UI's
Autocompleteinternally sets adata-highlightedattribute on items, while the custom keyboard navigation (which exists because Lexical intercepts key events before Base UI sees them) manages its ownisActivehighlight. The two systems can point at different items, producing a double selection.Mouse interaction is unaffected because
onItemHighlightedalready syncs hover events intoisActive.UI Changes
Before
Before.mp4
After
After.mp4
Checklist
Note
Low Risk
Low risk UI-only change that adjusts how command items are highlighted; main risk is minor regressions in keyboard/mouse highlight behavior.
Overview
Fixes double-highlight in the chat composer slash-command menu by making the app-controlled
activeItemIdthe single source of truth for item styling.Disables Base UI auto-highlighting (
autoHighlight={false}), suppressesdata-highlightedstyles, forcesisActiveclasses to win, and addsonMouseMovesyncing so hover re-aligns the active item after keyboard navigation.Written by Cursor Bugbot for commit 489a230. This will update automatically on new commits. Configure here.
Note
Fix duplicate highlight in composer slash command menu
Commandcomponent's built-in auto-highlighting (autoHighlight=false) inComposerCommandMenuto remove the duplicate highlight.onHighlightprop toComposerCommandMenuItemthat fires onmousemovewhen the item is not already active, delegating highlight control to the parent viaonHighlightedItemChange.data-highlightedstyles on menu items in favor of the component's own active state styling.Macroscope summarized 489a230.