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

[Bug]: DatePicker setting and clearing date in range issues #17071

Closed
1 of 2 tasks
marcinmotNB opened this issue Jul 31, 2024 · 3 comments · Fixed by #17072
Closed
1 of 2 tasks

[Bug]: DatePicker setting and clearing date in range issues #17071

marcinmotNB opened this issue Jul 31, 2024 · 3 comments · Fixed by #17072
Assignees
Labels

Comments

@marcinmotNB
Copy link

Package

@carbon/react

Browser

No response

Package version

v1.62.1

React version

v17.0.2

Description

There is a problem with DatePicker component.

  • after selecting date range if user clicks outside date component calendar is opened and can't be closed (issue can be reproduced on carbon's storybook too),
  • when user clears date range start date input is not cleared,
Screen.Recording.2024-07-31.at.11.27.58.mov

Reproduction/example

https://stackblitz.com/edit/vitejs-vite-bngjrz

Steps to reproduce

  • create DatePicker with range and calendar
  • select range
  • click somewhere outside component

Suggested Severity

Severity 2 = User cannot complete task, and/or no workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

@2nikhiltom
Copy link
Contributor

2nikhiltom commented Jul 31, 2024

Duplicate of #16740
This issue was not observed on and before 1.58

Also it seems like 17071 (on latest: 1.62.1) and 16740 (on :v1.58.0 ) are not actually duplicates

Issue 17071: After selecting a date range, if the user clicks outside the date component, the calendar opens and cannot be closed.

Issue 16740: After selecting a date range initially, the calendar closes. However, if the user opens the end date calendar, does not select any date, and clicks outside the calendar, it won't close.

@marcinmotNB
Copy link
Author

Is there also duplicate of second problem (resetting values)?

@2nikhiltom
Copy link
Contributor

I rolled back to older version and did some debugging it seems like the reported issue is happening because of the focus which is added

  const onCalendarClose = (selectedDates, dateStr) => {
    endInputField?.current?.focus();
    calendarRef?.current?.calendarContainer?.classList.remove('open');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
2 participants