authorgravatar for aab.hajjar@gmail.comAbdulelah Hajjar <aab.hajjar@gmail.com> 2026-03-30 04:14:59+03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-03-29 18:14:59-07:00
log63584449002d93aab65599ec34d2352663d5caf7
tree9070e8df4ab8e3617a56c3f178f55f9e8afb9e72
parent792ad4b5c1ed226be33d1623de8cbaf828f9053d
signature Signed by PGP key B5690EEEBB952194

fix(web): Fix duplicate highlight in composer slash command menu (#1445)


1 files changed, 8 insertions(+), 2 deletions(-)

apps/web/src/components/chat/ComposerCommandMenu.tsx+8-2
......@@ -43,6 +43,7 @@ export const ComposerCommandMenu = memo(function ComposerCommandMenu(props: {
4343}) {
4444 return (
4545 <Command
46 autoHighlight={false}
4647 mode="none"
4748 onItemHighlighted={(highlightedValue) => {
4849 props.onHighlightedItemChange(
......@@ -58,6 +59,7 @@ export const ComposerCommandMenu = memo(function ComposerCommandMenu(props: {
5859 item={item}
5960 resolvedTheme={props.resolvedTheme}
6061 isActive={props.activeItemId === item.id}
62 onHighlight={props.onHighlightedItemChange}
6163 onSelect={props.onSelect}
6264 />
6365 ))}
......@@ -80,15 +82,19 @@ const ComposerCommandMenuItem = memo(function ComposerCommandMenuItem(props: {
8082 item: ComposerCommandItem;
8183 resolvedTheme: "light" | "dark";
8284 isActive: boolean;
85 onHighlight: (itemId: string | null) => void;
8386 onSelect: (item: ComposerCommandItem) => void;
8487}) {
8588 return (
8689 <CommandItem
8790 value={props.item.id}
8891 className={cn(
89 "cursor-pointer select-none gap-2",
90 props.isActive && "bg-accent text-accent-foreground",
92 "cursor-pointer select-none gap-2 data-highlighted:bg-transparent data-highlighted:text-inherit",
93 props.isActive && "bg-accent! text-accent-foreground!",
9194 )}
95 onMouseMove={() => {
96 if (!props.isActive) props.onHighlight(props.item.id);
97 }}
9298 onMouseDown={(event) => {
9399 event.preventDefault();
94100 }}