Open Kxiru opened 2 weeks ago
This PR is being prevented from merging because it needs to be reviewed on Percy.
Go to Percy, find the build relevant to this PR and check if it looks as expected.
Once it's approved, add the label Review: Percy +1
to this PR.
Thanks @huwshimi for your review. Are you saying that the implemented logic would be better placed / integrated into updateVerticalPosition?
Thanks @huwshimi for your review. Are you saying that the implemented logic would be better placed / integrated into updateVerticalPosition?
Yes please!
This component already has support for adjusting the dropdown to be above or below, so there's no need to add additional state. Instead, you can just change the calculation from being relative to the scroll parent, to being relative to the window here:
Don't we want the component to be able to react according to BOTH the scroll parent and the window as well?
Don't we want the component to be able to react according to BOTH the scroll parent and the window as well?
Are you thinking of a scenario where the menu is at the bottom of a scrolling container, but that container is not at the bottom of the screen, so you want the menu to flip to above the button?
If that's the behaviour you want then you could add a second rect that is relative to the window and then adjust this calculation:
This would use both rects to calculate "dropdown fits below in scroll parent" AND "dropdown fits below in window", in pseudo code this could be something like:
setVerticalPosition(
scrollParentSpaceBelow >= dropdownHeight && windowSpaceBelow >= dropdownHeight || windowSpaceBelow > spaceAbove ? "bottom" : "top"
);
@huwshimi Hi there! I have actioned your suggestions. Please let me know if this is in line with what you were thinking :).
… vertically
Done
QA
Storybook
To see rendered examples of all react-components, run:
QA in your project
from
react-components
run:Install the resulting tarball in your project with:
Percy steps
N/A
Fixes