Skip to content

fix: Composed modal and modal close on esc#19908

Merged
maradwan26 merged 2 commits into
carbon-design-system:mainfrom
riddhybansal:composed_modal_close_on_esc
Jul 14, 2025
Merged

fix: Composed modal and modal close on esc#19908
maradwan26 merged 2 commits into
carbon-design-system:mainfrom
riddhybansal:composed_modal_close_on_esc

Conversation

@riddhybansal

@riddhybansal riddhybansal commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

Closes #19850

Fix ESC key not working in ComposedModal and modal when no element has focus

Changelog

New

  • Added document-level ESC key listener to ComposedModal and Modalfor consistent escape key behavior
  • Added comprehensive test coverage for ESC key functionality regardless of focus state

Testing / Reviewing

  • Open a ComposedModal or Modal with form inputs
  • Click outside the modal to remove focus from any input field
  • Press ESC key - modal should close (this would fail before the fix)
  • Verify ESC key still works when modal elements have focus

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

@riddhybansal riddhybansal requested a review from a team as a code owner July 14, 2025 13:32
@riddhybansal riddhybansal requested review from a team, maradwan26 and tay1orjones July 14, 2025 13:32
@netlify

netlify Bot commented Jul 14, 2025

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 34fcb22
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/687506f2ad02840008b9cd50
😎 Deploy Preview https://deploy-preview-19908--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 Jul 14, 2025

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 34fcb22
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/687506f2ebaa8d0008a0fd5c
😎 Deploy Preview https://deploy-preview-19908--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.

@netlify

netlify Bot commented Jul 14, 2025

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 25e59be
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/687507dd5eecfa0008a5a8f5
😎 Deploy Preview https://deploy-preview-19908--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.

@codecov

codecov Bot commented Jul 14, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.09%. Comparing base (ae3d208) to head (25e59be).
Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #19908   +/-   ##
=======================================
  Coverage   84.08%   84.09%           
=======================================
  Files         476      476           
  Lines       29696    29711   +15     
  Branches     5531     5532    +1     
=======================================
+ Hits        24971    24986   +15     
  Misses       4568     4568           
  Partials      157      157           
Flag Coverage Δ
main-packages 84.85% <100.00%> (+0.03%) ⬆️
web-components 83.35% <ø> (-0.03%) ⬇️

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.

@netlify

netlify Bot commented Jul 14, 2025

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 25e59be
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/687507dd62471100088ba5fd
😎 Deploy Preview https://deploy-preview-19908--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.

@heloiselui heloiselui left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tested it and it works as expected, thank you Riddhi.

@maradwan26 maradwan26 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🚀

@maradwan26 maradwan26 added this pull request to the merge queue Jul 14, 2025
Merged via the queue into carbon-design-system:main with commit 43b92e8 Jul 14, 2025
41 of 42 checks passed
@carbon-automation

Copy link
Copy Markdown
Contributor

Hey there! v11.87.0 was just released that references this issue/PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ComposedModal does not close on esc

3 participants