Skip to content

Conversation

balajis-qb
Copy link
Contributor

@balajis-qb balajis-qb commented Aug 18, 2025

Description

Linked issue: #5784

Problem
As mentioned in the linked ticket and the comments, the date range picker has an issue in it's refocus logic. If we select a start date, the focus should remain in the selected start date, as the selected date is not complete, so that user can use keyboard arrows to select the end date. But now for each date selection, regardless of startDate or endDate, we always change the focus back to date input on selection.

Changes

  • Updated the DatePicker component to improve handling of date selection completion when using the selectsRange prop.
  • Added logic to determine if the input should refocus based on the selection of start and end dates.
  • Introduced new tests to verify refocus behavior for various date range scenarios, ensuring correct functionality when selecting dates in a range.

This update addresses cases in which date selection happens through keyboard, which will avoid unnecessary refocus to the date input when the date is partially selected.

  • If we select a startDate, the focus won't change
  • If we select a valid endDate, the focus will move back to Date Input

Contribution checklist

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

- Updated the DatePicker component to improve handling of date selection completion when using the selectsRange prop.
- Added logic to determine if the input should refocus based on the selection of start and end dates.
- Introduced new tests to verify refocus behavior for various date range scenarios, ensuring correct functionality when selecting dates in a range.

This update addresses cases in which date selection happens through keyboard, which will avoid unnecessary refocus to the date input when the date is partialy selected.

Closes Hacker0x01#5784
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.23%. Comparing base (7c6c3d5) to head (007b190).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5793      +/-   ##
==========================================
- Coverage   97.23%   97.23%   -0.01%     
==========================================
  Files          30       30              
  Lines        3436     3435       -1     
  Branches     1455     1440      -15     
==========================================
- Hits         3341     3340       -1     
  Misses         95       95              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martijnrusschen martijnrusschen merged commit cf2eaa1 into Hacker0x01:main Aug 18, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants