the menu scrolls when the item is not completely in the menu
Opened this issue · 4 comments
Thank you for your work, it saved us. We found some very funny behaviour that you might be able to fix.
reproduce:
- create a windowed select box.
- create more options then the threshold,
- open the menu
- scroll to have an item which is not fully shown
- move your mouse over it
behaviour
expected: nothing happens
actual: the menu will scroll to the item.
alternative
- create a windowed select box.
- create more options then the threshold,
- open the menu
- scroll to the end
- move your mouse just a bit above the first shown element
behaviour
expected: nothing happens
actual: the menu slowly scrolls upwards
@gege83 Glad to hear this component is useful for you.
This happens because of the call to scrollToItem
here: src/MenuList.tsx:114. This is necessary for the menu to scroll when pressing the down arrow.
I think this is a fairly minor issue, but if you can figure out a fix that doesn't add too much complexity to the code, I'd be happy to accept a PR.
I opened up a PR for this fix. Would love some feedback on it.
@jacobworrel I opened PR which solves the issue.
Who ever lands here and PR is still not merged, feel free to use my forked branch instead.
npm install github:mikkpokk/react-windowed-select#main --save