Skip to content
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

Portaling bugged with scrollable parents #4554

Closed
Etheryte opened this issue Apr 23, 2021 · 5 comments
Closed

Portaling bugged with scrollable parents #4554

Etheryte opened this issue Apr 23, 2021 · 5 comments
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer

Comments

@Etheryte
Copy link

When using portaling, the dropdown position becomes bugged when a parent is scrolled while the dropdown is open.

Screen.Recording.2021-04-23.at.16.24.45.mov

Repro case: https://codesandbox.io/s/react-select-v3-sandbox-forked-lgkms
Also reproducible on the docs page if you manually edit the layout to have overflow.

This is a pretty common issue with dropdown libraries, common solutions include closing the dropdown on any parent scroll or trying to dynamically keep the position updated with a transform.

@ebonow
Copy link
Collaborator

ebonow commented Apr 23, 2021

Thanks for reporting @Etheryte ,

There are several existing issues we'll round up and look to resolve regarding fixed positioning and portaling that will be the focus of development following the TypeScript rewrite that is currently underway.

@ebonow ebonow added the issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer label Apr 23, 2021
@Methuselah96
Copy link
Collaborator

Methuselah96 commented May 7, 2021

Can you set the menuPortalTarget to be the scrollable parent? In your example it's set to document.body so that's why the menu's not moving.

Updated CodeSandbox: https://codesandbox.io/s/react-select-v3-sandbox-forked-un5el?file=/index.js

@Methuselah96 Methuselah96 added awaiting-author-response Issues or PRs waiting for more information from the author issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet and removed issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer labels May 7, 2021
@Etheryte
Copy link
Author

Etheryte commented May 7, 2021

@Methuselah96 Thanks for taking the time to look at this. While that would work for dropdowns which fit into the scrollable parent viewport (shown in light blue below), you will end up with cropping on longer dropdowns — the very problem that portaling is meant to solve. In short, setting the menuPortalTarget to the scrollable parent is equivalent to not using portaling at all. Hope this explanation makes sense, please let me know if I can clarify.

Screenshot 2021-05-07 at 16 44 15

@Methuselah96 Methuselah96 removed the awaiting-author-response Issues or PRs waiting for more information from the author label May 7, 2021
@Methuselah96
Copy link
Collaborator

Thanks for the response, sorry I was confusing portaling with something else. As @ebonow mentioned we're taking a closer look at menu positioning and related issues at the moment so hopefully we can get this resolved.

@Methuselah96 Methuselah96 added issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer and removed issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet labels May 7, 2021
@Methuselah96
Copy link
Collaborator

Methuselah96 commented May 7, 2021

This is the same issue as reported in #4088, so I'm going to go ahead and close this in order to consolidate the issues. Thanks for the helpful reproduction case, we hope to make some progress on this soon. I've added this issue and example to the list of issues and examples on that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants