-
Notifications
You must be signed in to change notification settings - Fork 198
[Bug] Calendar popup direction is only calculated on initial component loading #195
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
Comments
I opened PR #196 |
should be provided params to control pop up left or right |
@kingekinge in the PR above, I just fixed auto direction calculation logic. |
@atsuo-takahashi but when i checked with offical site it was on the left side . i want it to pop on from the left side . |
@akashengagebay I think your situation is depends on component's horizontal positioning on your page. As @kingekinge mentioned above, it would be nice to have an option to select horizontal pop up direction. |
i tried to hardcode the popup position and its works
|
react-tailwindcss-datepicker/src/components/Datepicker.tsx
Lines 169 to 185 in bf063fe
Currently, calendar popup direction (left or right) is determined by comparing window center and component center.
However, its calculation is only executed on initial component loading because statements are written within useEffect and second argument array is blank.
This causes the problem when component position changed after its initial loading.
Example
Initial position is right side from window center, so calendar popup direction is left.
Then, narrow window size.
Page layout is flex box design and component comes to left side when window size become narrow.
On this situation, calendar popup direction is not re-calculated, so its popup direction is still left and this causes users cannot click most part of calendar popup.
Possible solution is calculate direction each time when calendar pops up.
The text was updated successfully, but these errors were encountered: