Skip to content

feat(cds-dialog): new preview component#21853

Merged
maradwan26 merged 38 commits into
carbon-design-system:mainfrom
maradwan26:wc-preview-dialog
Apr 8, 2026
Merged

feat(cds-dialog): new preview component#21853
maradwan26 merged 38 commits into
carbon-design-system:mainfrom
maradwan26:wc-preview-dialog

Conversation

@maradwan26

@maradwan26 maradwan26 commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Closes #20539
Closes #20973

Adds new preview component cds-dialog to Carbon Web Components, matching its React counterpart preview__Dialog.

Changelog

New

  • Added cds-dialog, cds-dialog-title, cds-dialog-footer, etc. and respective logic, styles, and stories
    • I kept the attribute prevent-close-on-click-outside since it's also in modal as I figured users would expect to find it here too
  • Exported as preview__CDSDialog, preview__CDSDialogTitle, etc. from the central index.ts
  • Synced React and WC stories and fixed some broken controls in React with aria-label and aria-labelledby

Changed

  • Made private methods protected in modal.ts to allow for overriding
  • Added new selectors in button.scss to support cds-dialog-footer-button
  • React:
    • Updated how Dialog handles scrolling content to use a resizeObserver and also remove the gradient when the container is small via cds--dialog-scroll-content--no-fade. This matches the implementation in Modal and ComposedModal
    • Deprecated ariaLabel, ariaLabelledBy, and ariaDescribedBy in favour of aria-label, aria-labelledby, and aria-describedby respectively
    • Fixed accessibility violation Element with "region" role does not have a label

Testing / Reviewing

  • Go to Preview/Dialog
  • Stories, functionalities, styles, etc. should match React

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

@netlify

netlify Bot commented Mar 17, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 301c70e
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/69d698f6ff75780008e46083
😎 Deploy Preview https://deploy-preview-21853--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 Mar 17, 2026

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 301c70e
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/69d698f6b8bbcd0008bf98d1
😎 Deploy Preview https://deploy-preview-21853--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 Mar 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.87629% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.90%. Comparing base (13f2327) to head (301c70e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../web-components/src/components/modal/modal-body.ts 92.10% 3 Missing ⚠️
...kages/web-components/src/components/modal/modal.ts 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21853      +/-   ##
==========================================
- Coverage   94.93%   94.90%   -0.03%     
==========================================
  Files         541      541              
  Lines       45192    45250      +58     
  Branches     6372     6331      -41     
==========================================
+ Hits        42903    42946      +43     
- Misses       2157     2172      +15     
  Partials      132      132              
Flag Coverage Δ
main-packages 89.16% <100.00%> (+<0.01%) ⬆️
web-components 97.70% <93.93%> (-0.01%) ⬇️

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.

@maradwan26 maradwan26 marked this pull request as ready for review March 17, 2026 21:12
@maradwan26 maradwan26 requested review from a team as code owners March 17, 2026 21:12
Comment thread packages/web-components/src/components/dialog/dialog.ts
Comment thread packages/web-components/src/components/dialog/dialog.ts
Comment thread packages/web-components/src/components/dialog/dialog.scss Outdated
Comment thread packages/react/src/components/Dialog/Dialog.tsx
Comment thread packages/web-components/src/components/dialog/dialog.stories.ts Outdated
@maradwan26

maradwan26 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

Converting to draft for now to fix avt tests failing.
Fixed ✅

@maradwan26 maradwan26 marked this pull request as draft March 18, 2026 14:35
Comment thread packages/web-components/src/components/dialog/dialog.ts

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

LGTM!

@heloiselui heloiselui mentioned this pull request Apr 2, 2026
4 tasks
Comment thread packages/react/src/components/Dialog/Dialog.tsx
@maradwan26 maradwan26 enabled auto-merge April 8, 2026 17:54
@maradwan26 maradwan26 added this pull request to the merge queue Apr 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 8, 2026
@maradwan26 maradwan26 added this pull request to the merge queue Apr 8, 2026
Merged via the queue into carbon-design-system:main with commit 7988f34 Apr 8, 2026
39 checks passed
@maradwan26 maradwan26 deleted the wc-preview-dialog branch April 8, 2026 20:16
MarianaAa01 pushed a commit to MarianaAa01/carbon that referenced this pull request May 29, 2026
* feat(dialog): new wc preview component

* fix: footer elements selector

* fix: align stories

* fix(react): update scrolling content handling

* chore: export as preview

* fix: formatting

* fix: remove legacy test

* fix: deprecate ariaLabel

* docs: sync react and wc stories

* chore: update snapshots

* chore: cleanup and formatting

* chore: cleanup

* fix: esc key handling and selector override

* test: update tests

* fix: ts

* fix: a11y

* refactor: remove uneccesary aria-label prop

* chore: cleanup

* chore: cleanup aria-labelledby

* docs: dialog markdown cdn

* refactor: extend class

* fix: prevent close on esc for non-modal dialog

* test: label handling

* Update packages/react/src/components/Dialog/Dialog.tsx

Co-authored-by: Adam Alston <aalston9@gmail.com>

* fix: derive body label from custom id

* refactor: types, set labels on render

* fix(a11y): apply proper labelling and role on scroll container

* refactor: aria-labelledby title fallback

* chore: cleanup

* fix(esc): add !open guard

* fix(body): scope userDefinedTabindex guard to tabindex only

* docs: add see preview reference

* chore: remove preview prefix from export

---------

Co-authored-by: Adam Alston <aalston9@gmail.com>
Co-authored-by: Heloise Lui <71858203+heloiselui@users.noreply.github.com>
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.

[preview__Dialog]: add controls args to every story Create preview_dialog component in @carbon/web-components

4 participants