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

Focus jumps to End Date before user is finished typing Start Date #2225

Open
onlywei opened this issue Jan 4, 2023 · 0 comments
Open

Focus jumps to End Date before user is finished typing Start Date #2225

onlywei opened this issue Jan 4, 2023 · 0 comments

Comments

@onlywei
Copy link

onlywei commented Jan 4, 2023

react-dates version
e.g. react-dates@21.8.0

Describe the bug
After both start date and end date have been selected, going back to modify the start date causes the focus to jump into the end date before the user is finished typing.

Source code (including props configuration)
Steps to reproduce the behavior:

const [startDate, setStartDate] = useState(null);
const [endDate, setEndDate] = useState(null);
const [focusedInput, setFocusedInput] = useState(null);

function onDatesChange({startDate: newStartDate, endDate: newEndDate}) {
  setStartDate(newStartDate);
  setEndDate(newEndDate);
}

<DateRangePicker
  displayFormat="l" //Results in M/D/YYYY
  startDate={startDate}
  startDateId="your_unique_start_date_id"
  endDate={endDate}
  endDateId="your_unique_end_date_id"
  onDatesChange={onDatesChange}
  focusedInput={focusedInput}
  onFocusChange={setFocusedInput}
  isOutsideRange={() => false}
/>

Screenshots/Gifs
I have created a reproduction repo for this issue here: https://github.com/onlywei/react-dates-focus-issue-repro

Desktop (please complete the following information):

  • OS: [e.g. iOS] MacOS
  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22] 108

Is the issue reproducible in Storybook?
N/A

Additional context
I have created a reproduction repo for this issue here: https://github.com/onlywei/react-dates-focus-issue-repro

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

No branches or pull requests

1 participant