-
Notifications
You must be signed in to change notification settings - Fork 2.3k
🐛 Add missing datepicker close call onPopperKeyDown event - to handle ESC keydown event outside the day component #5621
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
🐛 Add missing datepicker close call onPopperKeyDown event - to handle ESC keydown event outside the day component #5621
Conversation
… esc keydown event outside the day component Closes Hacker0x01#5520
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5621 +/- ##
=======================================
Coverage 96.98% 96.99%
=======================================
Files 30 30
Lines 3355 3356 +1
Branches 1416 1420 +4
=======================================
+ Hits 3254 3255 +1
+ Misses 101 99 -2
- Partials 0 2 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @balajis-qb Thank you so much for the fix and your time. I tested your changes, and the behavior continues: I must press Screen.Recording.2025-05-19.at.1.13.15.p.m.movCould you please let me know if that's the intended behavior? Again, thank you for your time |
|
Hi @HugoLiconV , Are you using the latest version of the package? Because previously also I can able to reproduce the issue only when the header arrows are focused (I added the steps to reproduce). I fixed that and now I couldn't able to reproduce the issue. If this issue is coming for any specific case, please share your example code. |
react-datepicker-issue.mp4Just sharing the screenrecording I tried. I couldn't able to reproduce. |
|
Hi again, @balajis-qb. Yes, I updated my local branch and ensured your changes were there. I think the problem is that we're following different steps. Here's how you can reproduce it: Note You don't need any specific setup. You can reproduce it using the default example in https://reactdatepicker.com/
Please let me know if you can replicate it with these steps. |
|
Hi @balajis-qb, just wanted to ask if you were able to reproduce the issue |
|
Hi @HugoLiconV , I couldn't reproduce the issue. I attached a screen-recording I tried in the previous comments. |
 <h3>Snyk has created this PR to upgrade react-datepicker from 8.3.0 to 8.4.0.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> - The recommended version is **1 version** ahead of your current version. - The recommended version was released **a month ago**. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>react-datepicker</b></summary> <ul> <li> <b>8.4.0</b> - <a href="https://redirect.github.com/Hacker0x01/react-datepicker/releases/tag/v8.4.0">2025-05-25</a></br><h2>What's Changed</h2> <ul> <li>Fix readOnly prop for a clearButton and inline calendare by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SergeyKazarinov/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/SergeyKazarinov">@ SergeyKazarinov</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2991375173" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5564" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5564/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5564">#5564</a></li> <li>Fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2999650705" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5573" data-hovercard-type="issue" data-hovercard-url="/Hacker0x01/react-datepicker/issues/5573/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/issues/5573">#5573</a> 🐛 Fix the Selected Year Picker style when no date is selected by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/balajis-qb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/balajis-qb">@ balajis-qb</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3006849862" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5584" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5584/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5584">#5584</a></li> <li>Parse date range with dashes by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alexz-sg/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/alexz-sg">@ alexz-sg</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3002849585" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5578" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5578/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5578">#5578</a></li> <li>Include SCSS files in exports by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/saltire/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/saltire">@ saltire</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2984074621" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5560" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5560/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5560">#5560</a></li> <li>🐛 Add missing datepicker close call onPopperKeyDown event - to handle ESC keydown event outside the day component by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/balajis-qb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/balajis-qb">@ balajis-qb</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3055666607" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5621" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5621/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5621">#5621</a></li> <li>🐛 Fix EndDatePicker selection range progress by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/balajis-qb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/balajis-qb">@ balajis-qb</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3054052205" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5619" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5619/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5619">#5619</a></li> <li>Add Claude Code GitHub Workflow by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/martijnrusschen/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/martijnrusschen">@ martijnrusschen</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3084187602" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5640" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5640/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5640">#5640</a></li> <li>Move away from <a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/import/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/import">@ import</a> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/martijnrusschen/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/martijnrusschen">@ martijnrusschen</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2858784029" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5426" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5426/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5426">#5426</a></li> <li>🐛 Apply --keyboard-selected to only if it's not already selected by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/balajis-qb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/balajis-qb">@ balajis-qb</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3089230056" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5651" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5651/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5651">#5651</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alexz-sg/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/alexz-sg">@ alexz-sg</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3002849585" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5578" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5578/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5578">#5578</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://redirect.github.com/Hacker0x01/react-datepicker/compare/v8.3.0...v8.4.0"><tt>v8.3.0...v8.4.0</tt></a></p> </li> <li> <b>8.3.0</b> - <a href="https://redirect.github.com/Hacker0x01/react-datepicker/releases/tag/v8.3.0">2025-04-09</a></br><h2>What's Changed</h2> <ul> <li>🐛🎨 Apply the <code>--selected</code> class for the YearPicker when the <code>selectsMultiple</code> is enabled by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/balajis-qb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/balajis-qb">@ balajis-qb</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2959609233" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5524" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5524/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5524">#5524</a></li> <li>Fix <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2924009885" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5502" data-hovercard-type="issue" data-hovercard-url="/Hacker0x01/react-datepicker/issues/5502/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/issues/5502">#5502</a>: 🐛 Fix '--in-selecting-range' class apply condition for End Date Picker by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/balajis-qb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/balajis-qb">@ balajis-qb</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2924034579" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5503" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5503/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5503">#5503</a></li> <li>🎨🔨 Re-adjust the height of TimePicker on Calendar resize due to number of days by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/balajis-qb/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/balajis-qb">@ balajis-qb</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2975931816" data-permission-text="Title is private" data-url="Hacker0x01/react-datepicker#5539" data-hovercard-type="pull_request" data-hovercard-url="/Hacker0x01/react-datepicker/pull/5539/hovercard" href="https://redirect.github.com/Hacker0x01/react-datepicker/pull/5539">#5539</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://redirect.github.com/Hacker0x01/react-datepicker/compare/v8.2.1...v8.3.0"><tt>v8.2.1...v8.3.0</tt></a></p> </li> </ul> from <a href="https://redirect.github.com/Hacker0x01/react-datepicker/releases">react-datepicker GitHub release notes</a> </details> </details> --- > [!IMPORTANT] > > - Check the changes in this PR to ensure they won't cause issues with your project. > - This PR was automatically created by Snyk using the credentials of a real user. --- **Note:** _You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs._ **For more information:** <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiIzMzc0YWFkMi0wNzJhLTQyNDUtOTgzYi1mZjhmNzAyYWI2NjQiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjMzNzRhYWQyLTA3MmEtNDI0NS05ODNiLWZmOGY3MDJhYjY2NCJ9fQ==" width="0" height="0"/> > - 🧐 [View latest project report](https://app.snyk.io/org/dawoudio/project/e27b08aa-e5d2-4b10-8303-630a69d0b669?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 📜 [Customise PR templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template) > - 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/dawoudio/project/e27b08aa-e5d2-4b10-8303-630a69d0b669/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/dawoudio/project/e27b08aa-e5d2-4b10-8303-630a69d0b669/settings/integration?pkg=react-datepicker&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) [//]: # 'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"react-datepicker","from":"8.3.0","to":"8.4.0"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"3374aad2-072a-4245-983b-ff8f702ab664","prPublicId":"3374aad2-072a-4245-983b-ff8f702ab664","packageManager":"npm","priorityScoreList":[],"projectPublicId":"e27b08aa-e5d2-4b10-8303-630a69d0b669","projectUrl":"https://app.snyk.io/org/dawoudio/project/e27b08aa-e5d2-4b10-8303-630a69d0b669?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-05-25T12:21:10.113Z"},"vulns":[]}'
Description
Linked issue: #5520
Problem
As mentioned in the linked issue, the datepicker needs 2 esc key press to close. This is not happening always. If the control is there in any days, then one
ESCkey itself is closing the date picker. But if it's there in the DatePicker header (For E.g., Previous or Next month navigation button), then the firstESCkey will just move the focus back to the DatePicker Input and then second Esc key only will close the DatePicker.To Reproduce
Steps to reproduce the behavior:
Changes
onPopperKeyDownevent handlerContribution checklist