-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: datepicker onchange trigger issue #16202
fix: datepicker onchange trigger issue #16202
Conversation
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Using allow input will restrict user for inputing dates without calendars and may led to many a11y issues. The actual issue was in range plugin. From and to dates are not correctly fetched from the flatpicker configs , resulting in formating of dates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@riddhybansal This looks great! Could a unit test be added to ensure this continues to work as expected in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after test is added!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Riddhi! The fix LGTM!
Just one comment regarding the test case.
I was testing the current version and the bug happens on this sequence:
1 - The user will add a start and end date
2 - Datepicker has to be closed after the user click in the document.body
to remove the focus from the component.
3 - The user have to place the focus again in the Datepicker by clicking on the start or end date and the Datepicker will open
4 - Repeat step 2 and the bug will happen
Maybe if you add a step to return focus to one of the inputs before simulate a click, it will cover the bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
4c0d5a1
Closes #16125
Closes #13128
Closes #15925
Closes #14047
Closes #14465
When clicking outside a DatePickerInput (after having already set a date previously) the on Change handler fires with unexpected dates in the payload of the handler.
Changelog
Changed
Testing / Reviewing
set two dates with the datepicker.
click again on one of the inputs to open the calendar
click outside or click on another form element or tab away, Dates should be unchanged .