Skip to content

Commit

Permalink
Update modules/react/combobox/lib/ComboboxMenuItem.tsx
Browse files Browse the repository at this point in the history
Co-authored-by: Raisa Primerova <[email protected]>
  • Loading branch information
mannycarrera4 and RayRedGoose authored Sep 20, 2023
1 parent ef6293d commit 475573a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions modules/react/combobox/lib/ComboboxMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ export const useComboboxMenuItem = composeHooks(

// focus on the item with the cursor
React.useLayoutEffect(() => {
if (model.state.mode === 'single') {
if (model.state.cursorId === id) {
if (model.state.mode === 'single' && model.state.cursorId === id) {
// delay focus changes to allow PopperJS to position
requestAnimationFrame(() => {
localRef.current?.focus();
});
}
}
}, [id, localRef, model.state.cursorId, model.state.mode]);

Expand Down

0 comments on commit 475573a

Please sign in to comment.