Not closing the calendar on selection of a date
See original GitHub issueThe calendar is not hidden when a calendar date is selected. No errors or warnings are placed into the console. React Calendar V 0.53.0
<DatePicker
className={"date-field" + (className ? " " + className : "") + (error ? " error" : "")}
selected={date}
onChange={(newValue) => onChange(identifier, newValue)}
dateFormat="DD/MM/YYYY"
/>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:15 (3 by maintainers)
Top Results From Across the Web
React-datepicker | Calendar not closing on selection of date
Recently I picked up a project that uses react-datepicker and there's an issue where the calendar just isn't closing on selection of a...
Read more >Datepicker not closing after selection - Chrome - OutSystems
I have some logic built into my Datepicker which requires me to refresh the date selections when a From or To Date is...
Read more >DatePicker / How To / Prevent the Popup Close - React
To prevent the DatePicker popup from closing, use the preventDefault method. The following example demonstrates how to prevent the popup from closing.
Read more >React Multi Date Picker - Events
a simple React datepicker component for working with gregorian, persian, arabic and indian calendars with the ability to select the date in single, ......
Read more >react-datetime - npm
It is possible to disable dates in the calendar if the user are not allowed to select them, e.g. dates in the past....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
adding
<label onClick={e => e.preventDefault()}><DatePicker .... /></label>
fixed this issue for me. In debugger I found that after select,setOpen(false)
was called and DatePicker was closed but right after that it was reopened again (by label? 🤔)edit: I’m using
semantic-ui-react
that has their own implementation of label behavior, but you have the idea…If the datepicker remains open because it is wrapped inside
label
, you can callpreventDefault
ononChange
.