简体   繁体   中英

Popper Component Scrolling to top on selecting element

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.

我已经在 useCallback 中包装了自定义 popper,现在它可以工作了,所以你可以试试这个

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM