Skip to content

Commit

Permalink
Remove pointerenter workaround as it is fixed in latest Floating UI
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Jan 8, 2025
1 parent ae4e611 commit d12cefb
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions packages/react/src/menu/root/useMenuRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,25 +217,16 @@ export function useMenuRoot(parameters: useMenuRoot.Parameters): useMenuRoot.Ret
typeahead,
]);

const virtualEventHandler = listNavigation.reference?.onPointerDown;

const getTriggerProps = React.useCallback(
(externalProps?: GenericHTMLProps) => {
const props = getReferenceProps(
(externalProps?: GenericHTMLProps) =>
getReferenceProps(
mergeReactProps(externalProps, {
onMouseEnter() {
setHoverEnabled(true);
},
}),
);
return {
...props,
// Floating UI doesn't check for virtual pointer on `onPointerEnter`, only
// `onPointerDown`. TODO: Fix internally in Floating UI.
onPointerEnter: virtualEventHandler,
};
},
[getReferenceProps, virtualEventHandler],
),
[getReferenceProps],
);

const getPopupProps = React.useCallback(
Expand Down

0 comments on commit d12cefb

Please sign in to comment.