How to use interaction based react-aria hooks with react-aria-components? #6260
-
Hey, While opening the popover and controlling the selected item state with up/down keys when the popover is open is straightforward, I'm having trouble changing selection based on hovering over ListBoxItem component using the useHover hook. The useHover hook is not registering hover events on the list items. function AriaListBoxItem(props: ListBoxItemProps ) {
let { hoverProps } = useHover({ onHoverStart() {
console.log(`hovered on item ${props.id}`);
},
})
return (
<ListBoxItem {...hoverProps} {...props} />
);
} Is this because of the use of the same hook under the hood, or is there another reason? If there is any other better way then do lemme know 😄. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hover event handlers ( |
Beta Was this translation helpful? Give feedback.
Hover event handlers (
onHoverStart
,onHoverChange
,onHoverEnd
) were added toListboxItem
via #5777 (and other collection items via #6255). Those will be part of the upcoming release, or you can use them now in the nightlies. You won't need to useuseHover
when that becomes available since it is used under the hood.