-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menu is re-rendering after scrolling the page and trying to click on an option #4159
Comments
Greetings @Wojtasik and Confirmed. It appears that scrolling the page while a fixed menu causes the menu position to get lost after an option is hovered. However, I am not certain what the expected/desired behavior is as the menu position is being specified as fixed and the page is being scrolled down. I will mark this is needs-review as its unclear to me what the expected solution should be. |
Hey @Wojtasik! I know it's been a long time, but we're finally looking into old menu positioning issues. Can you help me understand what your use case for using |
Hi @Methuselah96 - thanks for getting back to me with this one!
I cannot remember the use case exactly, but I think it was related to iPad (tablet) usage.
Agreed. The bug was about the menu jumping around after user has scrolled down. Just checked and still can see this bug happening in the code sandbox example in the ticket description. Please let me know if it helps or if I can do anything else to help with this one. Thanks! |
This issue keep be happened yet when I customize Menu component. <Select
components={{
Menu: ({ children, ...rest }) => (
<components.Menu {...rest}>{children}</components.Menu>
),
}}
/> |
@devdreamsolution |
I've resolved the issue. const CustomizeMenu = ({children, ...rest}) => (
<components.Menu {...rest}>{children}</components.Menu>
)
<Select
components={{
Menu: CustomizeMenu
}}
/> |
When using
react-select
withmenuPostion="fixed"
I've noticed a strange behaviour when trying to select an option after scrolling down.The issue can be reproduced in this sandbox: https://codesandbox.io/s/react-codesandboxer-example-mxslt?file=/example.js
Steps:
Is this an expected behaviour?
Here is what I found after digging into the code:
onOptionHover
gets calledreact-select/packages/react-select/src/Select.js
Lines 1142 to 1147 in 32ad5c0
setState
;setState
was called the menu is rerendered and freshly calculated offset is applied:react-select/packages/react-select/src/components/Menu.js
Lines 519 to 521 in 32ad5c0
Thanks,
Patryk.
P.S. Thanks for this awesome library!
The text was updated successfully, but these errors were encountered: