Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/popular-baboons-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/listbox": patch
---

Fix item highlighting in `AutocompleteSection` during keyboard navigation (#3713)
10 changes: 3 additions & 7 deletions packages/components/listbox/src/use-listbox-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,9 @@ export function useListboxItem<T extends object>(originalProps: UseListboxItemPr
itemProps = removeEvents(itemProps);
}

const isHighlighted = useMemo(() => {
if (shouldHighlightOnFocus && isFocused) {
return true;
}

return isMobile ? isHovered || isPressed : isHovered;
}, [isHovered, isPressed, isFocused, isMobile, shouldHighlightOnFocus]);
const isHighlighted =
(shouldHighlightOnFocus && isFocused) ||
(isMobile ? isHovered || isPressed : isHovered || (isFocused && !isFocusVisible));

const getItemProps: PropGetter = (props = {}) => ({
ref: domRef,
Expand Down