You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My goal is to create a picker that supports date time ranges in a single DatePicker. My current plan is to add two time inputs below the calendar: one for start and one for end. Basically, just showTimeInput x2.
Possible solutions (for my case)
Add a prop to prevent calendar refocus on blur: Kinda ugly, but then the client could decide if/when they want this behavior.
Allow multiple time inputs: deferFocusInput is already disabled for time input, so allowing for multiple inputs would not require a change to the current blur behavior.
I should just find a different way to do this: I'm not sold on my current implementation, and would be interested to hear other thoughts. That said, other users may find this behavior unintuitive in the future.
The text was updated successfully, but these errors were encountered:
dwoznicki
changed the title
Child inputs cannot be focused
Inputs as children cannot be focused
Jul 23, 2019
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Expected behavior
When passing in inputs as children to
DatePicker
, it should be possible to focus them.Actual behavior
Currently, once the calendar input is blurred, focus is immediately reapplied to it. You can see this happening below.
react-datepicker/src/index.jsx
Lines 354 to 365 in 5d5cc88
The reasoning behind this behavior is mentioned here: #730 (comment)
Refocusing the calendar input makes it impossible to focus other elements inside the popper.
Steps to reproduce
Something like so:
What I'm trying to achieve
My goal is to create a picker that supports date time ranges in a single
DatePicker
. My current plan is to add two time inputs below the calendar: one for start and one for end. Basically, justshowTimeInput
x2.Possible solutions (for my case)
deferFocusInput
is already disabled for time input, so allowing for multiple inputs would not require a change to the current blur behavior.The text was updated successfully, but these errors were encountered: