react-select icon indicating copy to clipboard operation
react-select copied to clipboard

closeMenuOnScroll not working

Open santialbo opened this issue 1 year ago • 5 comments

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.

santialbo avatar Jun 14 '23 08:06 santialbo

Same problem here

levipadre avatar Jun 27 '23 12:06 levipadre

It's a callback, please try closeMenuOnScroll={() => true}

elsheraey avatar Jul 15 '23 03:07 elsheraey

Then it closes the menu even if the user scrolls inside of it.

therealtgd avatar Sep 04 '23 10:09 therealtgd

@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.

ashahin101 avatar Apr 07 '24 10:04 ashahin101

this work fine for me

const handleCloseMenuOnScroll = e => !e.target.className?.includes("MenuList")? true : false
return (
    <Select
        closeMenuOnScroll={handleCloseMenuOnScroll}
        {...props}
    />
 )

ashahin101 avatar Apr 07 '24 11:04 ashahin101