Skip to content

Conversation

@maradwan26
Copy link
Contributor

Closes #19706
Closes #20734
Closes #20936

Updated focus management logic/styles, added features, and controls to all stories (in both versions) for Modal.

Changelog

New

  • Added controls to all stories for Modal in React and WC
  • Added scrolling content gradient rendering behaviour to cds-modal-body
  • New should-submit-on-enter attribute
    • Allows the user to use the Enter key as a "submit" action that clicks the primary footer button
  • New inline loading feature
    • Added respective attributes: loading-status, loading-description, loading-success-delay, and loading-icon-description
    • When the modal has a loading-status that is not inactive, a cds-inline-loading element will render in the modal-footer with the specified attributes for the description, success delay, etc.
    • Added respective styles and modal-footer-button behaviours
    • Added a MutationObserver that observes the modal footer to account for a specific case where the number of modal-footer-buttons dynamically changes while inline-loading is active in order to keep the footer-button behaviours updating
    • The modal fires an event cds-modal-on-loadingsuccess when the loading-status is finished
  • New aria label handling
    • The aria-label of the modal will be computed based on the cds-modal-label, providedaria-label, and cds-modal-heading.
    • Order of precedence is: cds-modal-label > aria-label > cds-modal-heading
    • Added a MutationObserver that observes the modal header to account for a specific case where the modal-heading, modal-label, and/or aria-label are dynamically changing after the modal has rendered in order to keep the aria-label updating
  • New focus handling on primary/secondary footer buttons
    • A passive modal will render with the close button (X) focused
    • A danger modal will render with the cancel button focused
    • A modal which prompts for confirmation/user decision (i.e. with a primary footer button) will render with the primary button focused
    • Any element that has data-modal-primary-focus will take precedence over all of the above cases

Changed

  • Changed the modal-close-button (X) to render as a cds-icon-button instead of the native button and added the respective styling fixes and tweaks

Testing / Reviewing

  • All new features and additions should work as expected
  • There should be no regression to already existing features/behaviours
  • Modal behaviours/styles/etc. should match React
  • Story controls should work for both React and Web Components

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

@maradwan26 maradwan26 requested a review from a team as a code owner November 24, 2025 22:37
@netlify
Copy link

netlify bot commented Nov 24, 2025

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

Name Link
🔨 Latest commit 7907ffe
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/6924de1d690d6f000830cafc
😎 Deploy Preview https://deploy-preview-21074--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
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 81.00000% with 57 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.50%. Comparing base (b486103) to head (1d807fe).

Files with missing lines Patch % Lines
...kages/web-components/src/components/modal/modal.ts 80.07% 54 Missing ⚠️
.../web-components/src/components/modal/modal-body.ts 83.33% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21074      +/-   ##
==========================================
- Coverage   92.62%   92.50%   -0.12%     
==========================================
  Files         515      515              
  Lines       38222    38510     +288     
  Branches     5861     5826      -35     
==========================================
+ Hits        35403    35625     +222     
- Misses       2669     2736      +67     
+ Partials      150      149       -1     
Flag Coverage Δ
main-packages 85.61% <ø> (ø)
web-components 96.67% <81.00%> (-0.21%) ⬇️

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
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 7907ffe
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6924de1da1c48c0008f78c01
😎 Deploy Preview https://deploy-preview-21074--carbon-elements.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
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7907ffe
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6924de1d4d05b500088ea8b1
😎 Deploy Preview https://deploy-preview-21074--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
Copy link

netlify bot commented Nov 24, 2025

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

Name Link
🔨 Latest commit 1d807fe
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/6924e10390151100085225c0
😎 Deploy Preview https://deploy-preview-21074--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
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 2e82ba2
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6924de4ea0cd3e0008147daf
😎 Deploy Preview https://deploy-preview-21074--carbon-elements.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
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 2e82ba2
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6924de4e1fac5200082e137e
😎 Deploy Preview https://deploy-preview-21074--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
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 1d807fe
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6924e103f4986200081a94e6
😎 Deploy Preview https://deploy-preview-21074--carbon-elements.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
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1d807fe
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6924e1035f24480008f78f04
😎 Deploy Preview https://deploy-preview-21074--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.

@maradwan26 maradwan26 requested review from a team and sunny-babbar and removed request for a team November 24, 2025 23:06
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.

[Modal]: add controls args to every story [Bug]: Modal does not place initial focus on primary/secondary buttons React/WC Parity: Modal

3 participants