Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/components/codeKeywords/keywordSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function KeywordSelector({
const [dropdownEl, setDropdownEl] = useState<HTMLElement | null>(null);
const [isAnimating, setIsAnimating] = useState(false);
const [orgFilter, setOrgFilter] = useState('');
const [showProjectPreview, setShowProjectPreview] = useState(false);
const {resolvedTheme: theme} = useTheme();

const isDarkMode = theme === 'dark';
Expand Down Expand Up @@ -134,8 +135,18 @@ export function KeywordSelector({
role="button"
tabIndex={0}
title={currentSelection?.title}
aria-label={
currentSelection?.title
? `${currentSelection?.title}: ${currentSelection[keyword]}. Click to select different project.`
: `Click to select project`
}
aria-expanded={isOpen}
onClick={() => setIsOpen(!isOpen)}
onKeyDown={e => e.key === 'Enter' && setIsOpen(!isOpen)}
onMouseEnter={() => setShowProjectPreview(true)}
onMouseLeave={() => setShowProjectPreview(false)}
onFocus={() => setShowProjectPreview(true)}
onBlur={() => setShowProjectPreview(false)}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Tooltip Flickers on Dual Interaction

The ProjectPreview tooltip disappears prematurely. When both mouse hover and keyboard focus are active, the onMouseLeave or onBlur handlers can hide the preview even if the element is still hovered or focused. This occurs because a single state variable manages both interaction types.

Fix in Cursor Fix in Web

>
<KeywordIndicatorComponent isOpen={isOpen} />
<span
Expand All @@ -157,8 +168,10 @@ export function KeywordSelector({
{currentSelection[keyword]}
</Keyword>
</AnimatePresence>
{!isOpen && showPreview && currentSelection?.title && (
<ProjectPreview className="no-copy">{currentSelection.title}</ProjectPreview>
{!isOpen && showProjectPreview && showPreview && currentSelection?.title && (
<ProjectPreview className="no-copy" aria-hidden="true">
{currentSelection.title}
</ProjectPreview>
)}
</span>
</KeywordDropdown>
Expand Down
Loading