Fixed menu position based on scrollable parent
This fixes 3822, as previously the positioning of the menu was based on the window height and the menu was being truncated if it could fit inside the window but not the scrollable parent. But now, the position will be based on the height and boundaries of the closest scrollable parent element, like in the case of a slide panel or a dialog box, where the panel/dialog can be placed anywhere in the window which limits the area where the menu can be viewed.
-----UPDATE-----
The scrollable parent must have a 'non-static' (or default) position in order for this fix to work. Ideally, position: relative would be enough for most cases but can be anything other than static.
🦋 Changeset is good to go
Latest commit: 12a174442939e931b28f4f6ecd65e95dd998b133
We got this.
This PR includes changesets to release 2 packages
| Name | Type |
|---|---|
| react-select | Major |
| @react-select/docs | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@charrondev yeah I forgot to mention that we have to add position: relative to the parent. I too had to use this in order to fix the issue on my end as well. I've updated the description now as well.
I'll try to update the logic of getScrollParent and update you when it's done.
@charrondev I've added the changes to getScrollParent. Let me know if anything else needs to be changed.
I also opened a PR with a fix and tests for this issue months ago, and it got no attention from the maintainers. I'd be curious to compare our two approaches, but I don't really have the time or energy right now. https://github.com/JedWatson/react-select/pull/3669
If @JedWatson is unavailable is there another active maintainer that could take a look at this? Going by the commits, the next person seems to be @gwyneplaine
@flexdinesh I saw that you have started to look into stuff in this repo, so, whenever you get some time, can you please take a look at this PR or ask someone else to merge this? Would really appreciate your help. Thanks!
The branch contains conflicts, if some with write access could help here. (This is a very old PR but the content seems relevant)