Popper Component Scrolling to top on selecting element

Viewed 260

I am using Material UI control - Autocomplete.

In this , I am using multiple selection.

I have below code made in reference to this answer

<Autocomplete
   PopperComponent={PopperMy}
   ...  
/>

const PopperMy = function (props) {
   return <Popper {...props} style={{width: "fit-content"}} placement="bottom-start" />;
};

Issue I am facing -

When I scroll and select any option from Popper , scroll automatically moves to top.

I tried adding position:"fixed" but not preventing getting auto scrolled to top on selection of option.

1 Answers

I have wrapped custom popper in useCallback and now it works, so you could try this

Related