react-select
react-select copied to clipboard
closeMenuOnScroll not working
closeMenuOnScroll seems to not be working Reproduction: https://codesandbox.io/s/codesandboxer-example-forked-wppm3h?file=/example.tsx
Debugging the code I see the following check is being done https://github.com/JedWatson/react-select/blob/a465818786afd4857c9155bef1e9aa2fe3356097/packages/react-select/src/Select.tsx#L1281
which is not passed when scrolling as document is not an HTMLElement.
Same problem here
It's a callback, please try closeMenuOnScroll={() => true}
Then it closes the menu even if the user scrolls inside of it.
@therealtgd > Then it closes the menu even if the user scrolls inside of it.
Even if you just pass "closeMenuOnScroll" as a prop (which is technically equal to true) as react-select docs suggests; still it doesn't work.
this work fine for me
const handleCloseMenuOnScroll = e => !e.target.className?.includes("MenuList")? true : false
return (
<Select
closeMenuOnScroll={handleCloseMenuOnScroll}
{...props}
/>
)