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

fix: make sure picker position is never outside body viewport #295

Conversation

ghiscoding
Copy link
Contributor

@ghiscoding ghiscoding commented Aug 17, 2024

  • most probably fixes this issue and the issue shown below
  • as reported by a user, if the input is a bit outside of the body viewport (ie, when the div is scrolled) then the picker was being positioned to an invalid coordinate because the picker is always appended to the document body which doesn't usually have any scroll and when that happened the calendar picker wasn't showing correctly because it also uses CSS flexbox and the picker started to stretch because it didn't have enough space in the body... so we can simply reposition it to be exactly on the body side (body width - picker width becomes the new X coordinate)
  • so because it doesn't have enough space and because it uses flexbox, it was stretching the picker making the 2 months as top/bottom as seen below which is not the behavior that we expect. So as mentioned above, if we set the picker a valid coordinate then it won't stretch and the picker stays visually correct, which is what this PR does by making sure it's repositioned outside the body viewport

notice below that the input is further on the right, which is why the picker is now being stretched by the flexbox

before fix

image

with fix (aligned on body right side which is the limit of the body viewport)

image

@uvarov-frontend uvarov-frontend merged commit 6f2f53d into uvarov-frontend:main Aug 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants