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 Docs: Date Picker display in Dialogs across browsers by setting Popover modal={true} #3066

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jassibacha
Copy link

Problem

The Date Picker's Calendar component was not consistently appearing inside Dialog components across several browsers, notably Firefox, Safari, and iOS Chrome. This issue hindered the usability and functionality of the Date Picker in modal scenarios, affecting developers and end-users alike.

Solution

After investigating various approaches, I discovered that setting modal={true} on the <Popover> component housing the Calendar effectively resolves the display issues. This adjustment ensures that the Popover behaves as expected within dialogs, making the Date Picker fully operational across the affected browsers.

Changes Made

  • Refined the Date Picker documentation with a callout to highlight the importance of the modal={true} prop for ensuring browser compatibility in dialog scenarios.

Impact

These changes enhance the Date Picker's reliability and functionality by ensuring its visibility in modal contexts across all major browsers and it should also enhance accessibility by limiting screen reader visibility to the Popover's content.

As I found myself going down a pretty big rabbit hole to resolve this, which initially led me to difference suggestions such as removing initialFocus from the Calendar (#910), I realize it couldn't hurt to try and add a small note to the docs to help people skip this headache and implement a better solution.

Additional Notes

This solution was identified by @morgan4080 in this thread.

It might be worth adding a note/callout on Popover as well.

Copy link

vercel bot commented Mar 19, 2024

@jassibacha is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@jassibacha jassibacha changed the title Fix: Date Picker display in Dialogs across browsers by setting Popover modal={true} Fix Docs: Date Picker display in Dialogs across browsers by setting Popover modal={true} Mar 19, 2024
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.

1 participant