Skip to content
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

Fix search type popover has 2 items highlighted #53330

4 changes: 4 additions & 0 deletions src/components/PopoverMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ function PopoverMenu({
if (isVisible) {
return;
}

// Update the focused item to match the selected item, but only when the popover is not visible.
// This ensures that if the popover is visible, highlight from the keyboard navigation is not overridden
// by external updates to the selected item, preventing user experience disruption.
setFocusedIndex(currentMenuItemsFocusedIndex);
}, [isVisible, currentMenuItemsFocusedIndex, setFocusedIndex]);

Expand Down
Loading