Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material UI components used with react-select resets scroll position

I am using @material-ui/core - ^3.5.1.

Have used react-select - ^2.2.0 in my code. Have customized react-select with material ui components.

My problem is scroll position is reset every time I open the drop-down.

Desired behaviour is it should scroll up to the position of selected element. Example on material-ui docs site seems to be working fine, but when I open the given example link in codesandbox, it doesn't.

Running example, it's forked from original codesandbox example link given on material ui docs site (this example uses material-ui-4 and react-select 3 but has same issue). Couldn't find any configurable prop for this behaviour in api docs.

Am I missing anything here?

like image 260
Ankit Utekar Avatar asked Jun 05 '19 11:06

Ankit Utekar


1 Answers

In you sandbox I changed react-select version to 2.4.4 and the scroll is restored.

In package.json use: "react-select": "^2.4.4"

like image 175
Sim Dim Avatar answered Oct 09 '22 01:10

Sim Dim