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

[Bug]: Date Picker is cut off when positioned on the right end of a page #823

Closed
lucafaggianelli opened this issue Nov 17, 2023 · 18 comments · Fixed by #1142
Closed

[Bug]: Date Picker is cut off when positioned on the right end of a page #823

lucafaggianelli opened this issue Nov 17, 2023 · 18 comments · Fixed by #1142
Labels
released on @beta-tremor-v4 released Status: Blocked A fix for this issue is blocked on another internal or external fix being in place Type: Bug Confirmed bug, something is not working as intended

Comments

@lucafaggianelli
Copy link
Contributor

Tremor Version

3.11.1

Link to minimal reproduction

none

Steps to reproduce

  1. Position a DatePicker at the right end of a page
  2. make it smaller than it normally is, i.e. :`className="w-58"``
  3. click on it so the calendar menu opens
  4. notice that the calendar is cut off
  5. an horizontal scroll bar appears in the page

What is expected?

the floating menu containing the calendar should be automatically moved to fit into the page

I would also accept an anchor option to force the menu to be anchored on the right of the input field rather than on the left

What is actually happening?

localhost_5173_ (2)

What browsers are you seeing the problem on?

Chrome

Any additional comments?

No response

@rajdip-b
Copy link
Contributor

@severinlandolt hey, I feel I can fix this. Should I submit a PR?

@severinlandolt
Copy link
Member

That would be great! I just assigned you. I have to go to sleep now🤣

@severinlandolt severinlandolt added the Type: Bug Confirmed bug, something is not working as intended label Nov 18, 2023
@rajdip-b
Copy link
Contributor

That would be great! I just assigned you. I have to go to sleep now🤣

Would try to submit the PR by the time you wake up!🤣

@rajdip-b
Copy link
Contributor

Hey guys, I was experimenting with the component and sort of found it difficult to fix the alignment automatically. This is so because the Calendar is being rendered in an absolute component, which makes it very tricky to use flex boxes. I however, created a flag that will dock the calendar to left/right, thereby fixing the issue.

Here is a demo
image
image

Can anyone suggest any improvements? @severinlandolt @lucafaggianelli

@severinlandolt
Copy link
Member

I've completed some tests and its basically a feature that our underlying library (headlessui) does not offer natively.
CleanShot 2023-11-20 at 01 01 12@2x

Thank you @rajdip-b for your initial effort and suggesting a new prop. We will do some thinking around that an come back later!

@rajdip-b
Copy link
Contributor

I've completed some tests and its basically a feature that our underlying library (headlessui) does not offer natively. CleanShot 2023-11-20 at 01 01 12@2x

Thank you @rajdip-b for your initial effort and suggesting a new prop. We will do some thinking around that an come back later!

Sure!!

@lucafaggianelli
Copy link
Contributor Author

Yep indeed I reached the same conclusion on headlessui. Though I saw you use the lib floating ui as well in tremor, which seems more suited for this task.

About the new property, maybe I would call it "anchor" or something similar to make it more flexible so it could have values like right, left, center for the horizontal alignment and top, bottom, middle for the vertical one, I see many libs using this pattern.

@rajdip-b
Copy link
Contributor

Yep indeed I reached the same conclusion on headlessui. Though I saw you use the lib floating ui as well in tremor, which seems more suited for this task.

About the new property, maybe I would call it "anchor" or something similar to make it more flexible so it could have values like right, left, center for the horizontal alignment and top, bottom, middle for the vertical one, I see many libs using this pattern.

Yeah even I did notice that. Should I proceed with the implementation, see what all changes I can implement? @lucafaggianelli @severinlandolt

@severinlandolt
Copy link
Member

Good news: https://x.com/adamwathan/status/1729274129264624056?s=20

@rajdip-b
Copy link
Contributor

Good news: https://x.com/adamwathan/status/1729274129264624056?s=20

I guess this issue can be closed then?

@severinlandolt
Copy link
Member

I will keep it open until Headless UI has been updated

@severinlandolt severinlandolt added the Status: Blocked A fix for this issue is blocked on another internal or external fix being in place label Nov 28, 2023
@rajdip-b
Copy link
Contributor

Sure!

@rlancejohnson
Copy link

Any update on this?

@severinlandolt
Copy link
Member

Hi @rlancejohnson → still blocked! Waiting for headless ui 4.0.

@severinlandolt
Copy link
Member

Hi @lucafaggianelli @rajdip-b @rlancejohnson! Brief update: The overflow problem still persists and it looks like that this won't be fixable soon. I will update this asap once there is a fixing headless ui release.

If you are in desperate need of a date picker with improved positioning, it's worth taking a look here: https://raw.tremor.so/docs/inputs/date-range-picker

CleanShot 2024-04-19 at 20 56 56@2x

@severinlandolt
Copy link
Member

Soon...
image

Copy link

github-actions bot commented Dec 7, 2024

🎉 This issue has been resolved in version 3.18.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This issue has been resolved in version 3.18.5-beta-tremor-v4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @beta-tremor-v4 released Status: Blocked A fix for this issue is blocked on another internal or external fix being in place Type: Bug Confirmed bug, something is not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants