Skip to content

fix(popover): keep popover open when selecting a date from datepicker#21705

Merged
devadula-nandan merged 6 commits into
carbon-design-system:mainfrom
nehaaprasad:fix/pop-get-cls-sel
Apr 24, 2026
Merged

fix(popover): keep popover open when selecting a date from datepicker#21705
devadula-nandan merged 6 commits into
carbon-design-system:mainfrom
nehaaprasad:fix/pop-get-cls-sel

Conversation

@nehaaprasad

@nehaaprasad nehaaprasad commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Closes #21690

Fix Popover so selecting a date from a DatePicker rendered in document.body does not trigger onRequestClose when that calendar belongs to an input inside the popover.

Changelog

New

  • Added regression tests for DatePicker calendar interactions inside Popover, including click and focusout behavior.

Changed

  • Updated Popover close logic to ignore outside click/focus transitions when the target is a .flatpickr-calendar associated with an input inside the current popover.
  • Kept normal close behavior for calendars not associated with inputs inside this popover.
  • Improved typing/narrowing around _flatpickr lookup in Popover internals.

Removed

  • None

Testing / Reviewing

[ ] Open Popover with DatePicker inside
[ ] Open calendar and select a date
[ ] Confirm Popover stays open
[ ] Confirm Popover still closes on outside click
[ ] Run Popover tests and ensure they pass

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • [ ] Updated documentation and storybook examples
  • Wrote passing tests that cover this change
  • [ ] Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@nehaaprasad nehaaprasad requested a review from a team as a code owner March 4, 2026 11:09
@netlify

netlify Bot commented Mar 4, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 4ecf41c
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/69ea3c85f52db10008038b6f
😎 Deploy Preview https://deploy-preview-21705--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 4, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit 4ecf41c
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/69ea3c8504b25b00085c5dbb
😎 Deploy Preview https://deploy-preview-21705--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Mar 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (fdf1e79) to head (4ecf41c).
⚠️ Report is 109 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21705      +/-   ##
==========================================
+ Coverage   94.62%   95.03%   +0.41%     
==========================================
  Files         535      538       +3     
  Lines       43637    45052    +1415     
  Branches     6209     6542     +333     
==========================================
+ Hits        41291    42815    +1524     
+ Misses       2212     2108     -104     
+ Partials      134      129       -5     
Flag Coverage Δ
main-packages 89.09% <100.00%> (+0.68%) ⬆️
web-components 97.86% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Comment thread packages/react/src/components/Popover/index.tsx Outdated
Comment thread packages/react/src/components/Popover/index.tsx Outdated
Comment thread packages/react/src/components/Popover/__tests__/Popover-test.js Outdated
Comment thread packages/react/src/components/Popover/__tests__/Popover-test.js
@nehaaprasad

Copy link
Copy Markdown
Contributor Author

@adamalston i have updated it, please check it out!

@adamalston

Copy link
Copy Markdown
Contributor

#21874 (comment)

@sangeethababu9223 sangeethababu9223 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nehaaprasad ,
Please update the PR description to match the standard PR template.
Also ci check for format is failing, you could solve it by running yarn format in local and pushing the changes to the PR.

@heloiselui

Copy link
Copy Markdown
Contributor

Hey @sangeethababu9223, @devadula-nandan and @adamalston , when you have a moment, could you take a look at this PR? I’ve updated the remaining items.

Comment thread packages/react/src/components/Popover/index.tsx Outdated
Comment thread packages/react/src/components/Popover/index.tsx
@devadula-nandan devadula-nandan added this pull request to the merge queue Apr 24, 2026
Merged via the queue into carbon-design-system:main with commit 64861d9 Apr 24, 2026
39 checks passed
@github-project-automation github-project-automation Bot moved this from 🚦 In Review to ✅ Done in Design System Apr 24, 2026
MarianaAa01 pushed a commit to MarianaAa01/carbon that referenced this pull request May 29, 2026
…carbon-design-system#21705)

* fix(popover): keep popover open when selecting a date from DatePicker

* fix(popover): keep popover open when selecting a date from DatePicker

* chore(popover): replace _flatpickr cast with safe narrowing

* fix(popover): remove unnecessary optional chaining and add TODO comment

---------

Co-authored-by: Sangeetha Babu <sangeetha9223@gmail.com>
Co-authored-by: “heloiselui” <helolui27@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Popover getting closed while selecting a date from DatePicker

5 participants