mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
fix(autocomplete): highlight item in AutocompleteSection during keyboard navigation (#3726)
This commit is contained in:
parent
985c2e1dd3
commit
d621b2923e
5
.changeset/popular-baboons-pull.md
Normal file
5
.changeset/popular-baboons-pull.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@nextui-org/listbox": patch
|
||||
---
|
||||
|
||||
Fix item highlighting in `AutocompleteSection` during keyboard navigation (#3713)
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user