Skip to content

Commit 3f70508

Browse files
committed
[menu] Simplify pending focus callback
1 parent 2fbd464 commit 3f70508

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/react/src/menu/root/MenuRoot.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,6 @@ export const MenuRoot = fastComponent(function MenuRoot<Payload>(props: MenuRoot
420420

421421
const direction = useDirection();
422422
const pendingFocusItem = store.useState('pendingFocusItem');
423-
const clearPendingFocusItem = useStableCallback(() => {
424-
store.set('pendingFocusItem', null);
425-
});
426423

427424
const listNavigation = useListNavigation(floatingRootContext, {
428425
enabled: !disabled,
@@ -439,7 +436,9 @@ export const MenuRoot = fastComponent(function MenuRoot<Payload>(props: MenuRoot
439436
externalTree: nested ? floatingTreeRoot : undefined,
440437
focusItemOnHover: highlightItemOnHover,
441438
pendingFocusItem,
442-
onPendingFocusItemChange: clearPendingFocusItem,
439+
onPendingFocusItemChange: () => {
440+
store.set('pendingFocusItem', null);
441+
},
443442
});
444443

445444
const onTyping = React.useCallback(

0 commit comments

Comments
 (0)