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

Date picker with popover is not opening #910

Open
ashreyas431 opened this issue Jul 12, 2023 · 28 comments · May be fixed by #1777
Open

Date picker with popover is not opening #910

ashreyas431 opened this issue Jul 12, 2023 · 28 comments · May be fixed by #1777

Comments

@ashreyas431
Copy link

Date picker is put into a separate component and called wherever needed but on clicking the date picker calendar is not showing

@luanlucho
Copy link

Same. Works in Chrome but not in Firefox

@erkanaltinors
Copy link

I got this error on my Astro project. I've fixed it by adding client directive to react component where it is imported into astro page.

@kitsunekyo
Copy link

you can try to hotfix it in your apps by removing the initialFocus attribute on <Calendar. let me know if this works for you.

@PeterGKafkakis
Copy link

Taking out initialFocus on datepicker.tsx did work for me.

@imksmv
Copy link

imksmv commented Dec 22, 2023

Taking out initialFocus on datepicker.tsx did work for me.

Indeed. So now on mobile devices it opens as well.

@diogocezar
Copy link

Worked for me too :D thanks <3

@mahamrana703
Copy link

Worked for me too

@lmac-1
Copy link

lmac-1 commented Feb 23, 2024

Thanks! Date picker wasn't opening for me on Firefox within a modal but removing initialFocus fixed the problem for me.

@sijirama
Copy link

ahh, thanks, that definitely did it, after removing initialFocus fixed it.

@M1ck0
Copy link

M1ck0 commented Mar 8, 2024

removing initialFocus did not work for me. Any ideas?

After bit of debugging I've noticed that <div data-radix-popper-content-wrapper>...</div> has these CSS styles inlined

    position: fixed;
    left: 0px;
    top: 0px;
    transform: translate(0px, -200%);
    min-width: max-content;
    will-change: transform;
    z-index: 50;

This pushes is out of view

@jassibacha
Copy link

jassibacha commented Mar 19, 2024

So this can actually be fixed by adding modal={true} to the <Popover>, and doesn't lose the initialFocus that way. Suggested here by @morgan4080

@EvansRobbie
Copy link

datepicker

I had a similar issue. I used fowardRef in my trigger i.e. button to fix this.

@shadcn shadcn added the Stale label Jun 12, 2024
@earhengleap
Copy link

So this can actually be fixed by adding modal={true} to the <Popover>, and doesn't lose the initialFocus that way. Suggested here by @morgan4080

It really worked.

@shadcn shadcn removed the Stale label Jun 20, 2024
@wasiowision
Copy link

So this can actually be fixed by adding modal={true} to the <Popover>, and doesn't lose the initialFocus that way. Suggested here by @morgan4080

Thankyou So Much man it works for me 🏆

@shadcn shadcn added the Stale label Jul 11, 2024
@mustakimkr
Copy link

So this can actually be fixed by adding modal={true} to the <Popover>, and doesn't lose the initialFocus that way. Suggested here by @morgan4080

I was rendering a date picker inside a Sheet. It started behaving weirdly. Then this solution worked for me.

@Rufai-Ahmed
Copy link

I an issue where the datepicker's CSS is not looking well.
Uploading image.png…

@Rufai-Ahmed
Copy link

Screenshot (147)

@Rufai-Ahmed
Copy link

The code:

`"use client";

import * as React from "react";
import { format } from "date-fns";
import { Calendar as CalendarIcon } from "lucide-react";

import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import { Calendar } from "@/components/ui/calendar";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";

export function DatePickerDemo() {
const [date, setDate] = React.useState();

return (


<Button
variant={"outline"}
className={cn(
"w-[280px] justify-start text-left font-normal",
!date && "text-muted-foreground"
)}
>

{date ? format(date, "PPP") : Pick a date}






);
}
`

@efgomes
Copy link

efgomes commented Jul 21, 2024

image

Could anyone help me with how to resolve this situation?

@aidrecabrera
Copy link

I have also encountered with this issue too. It seems that the date range picker component's styling is broken because of the latest version of react-day-picker, in my case version 9.0.0.

Here is a workaround for this:

  1. Delete the problematic version:
pnpm remove react-day-picker
  1. Install the older version of react-day-picker
pnpm add react-day-picker@^8.9.1

Hopefully that should fix the issue. Version 8.9.1 is working fine on my end.

image
image

Hope this helps! @efgomes @Rufai-Ahmed

@aidrecabrera
Copy link

Easiest solution right now is to downgrade to 8.10.1. The react-day-picker team has already been notified of this issue in the v9.0.0 release announcement

Describe the bug

CleanShot 2024-07-21 at 17 46 51@2x

Currently, the component looks like this.

Fix: You can currently fix this by downgrading react-day-picker to version 8.^

Affected component/components

Calendar, Date Picker, ...

How to reproduce

  1. Install Calendar component

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

Browsers

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

@liamicy3aaa
Copy link

Thanks @aidrecabrera. Now works after downgrading to 8.10.1

@MuhammedNihad
Copy link

MuhammedNihad commented Jul 22, 2024

I too ran into same issue. Datepicker styles were broken. Downgraded to 8.10.1 and it works well. Hope this will be fixed on 9.0.0 soon. Thanks very much @aidrecabrera

@thanhlq
Copy link

thanhlq commented Jul 22, 2024

I got the same issue with 9.0.1, 8.10.1 working fine!

@shadcn shadcn added the Stale label Aug 6, 2024
@moha-abdi
Copy link

So this can actually be fixed by adding modal={true} to the <Popover>, and doesn't lose the initialFocus that way. Suggested here by @morgan4080

Thanks lad! it works

@techcoder2007
Copy link

position: fixed;
left: 0px;
top: 0px;
transform: translate(0px, -200%);
min-width: max-content;
will-change: transform;
z-index: 50;

this steps did work for me.

@shadcn shadcn removed the Stale label Aug 26, 2024
@Op-Pautu
Copy link

Op-Pautu commented Nov 2, 2024

@shadcn why are you adding and removing "stale" label?

@shadcn
Copy link
Collaborator

shadcn commented Nov 2, 2024

It’s a bot (running under my username). I should’ve named it otherwise.

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 a pull request may close this issue.