Skip to content

feat(ToastNotification): add dismissable flag support - #1450

Merged
ndv99 merged 3 commits into
canonical:mainfrom
rumanowskak:feat-add-dismissible-flag-to-toast-notifications
Oct 23, 2026
Merged

ndv99 merged 3 commits into
canonical:mainfrom
rumanowskak:feat-add-dismissible-flag-to-toast-notifications

Conversation

@rumanowskak

Copy link
Copy Markdown
Contributor

Done

  • Added a dismissable?: boolean field to ToastNotificationType
  • ToastNotification (the floating single toast) no longer renders a dismiss button when dismissable is false.
  • ToastNotificationList (the expanded list view) no longer renders a dismiss button for individual non-dismissable notifications, and excludes them from the "Dismiss all"/"Dismiss N" bulk action.
  • Added a Storybook example demonstrating a non-dismissable toast.
  • Added test coverage for all of the above.

QA

Pinging @canonical/react-library-maintainers for a review.

Storybook

To see rendered examples of all react-components, run:

yarn start

QA in your project

from react-components run:

yarn build
npm pack

Install the resulting tarball in your project with:

yarn add <path-to-tarball>

QA steps

  • run yarn start to launch Storybook
  • go to the ToastNotification story
  • click Add Non-dismissable Warning (new button added by this PR)
  • confirm the toast appears with no x close button
  • click Toggle List View
  • confirm the same notification still has no x button in the expanded list, while the other (dismissible) notifications do
  • click Dismiss all
  • confirm it clears the dismissible notifications, but the non-dismissible ones remain in the list

Percy steps

  • List any expected visual change in Percy, or write something like "No visual changes expected" if none is expected.

Fixes

Fixes: # .

Comment thread src/components/Notifications/ToastNotification/ToastNotificationList.tsx Outdated
@Ninfa-Jeon

Copy link
Copy Markdown
Contributor

As noted previously, the Dismiss all button is misleading when the list only contains non-dismissable notifications. Additionally, the story rendered by default shows all types of notifications except the non-dismissable one. Would be nice to include it there.

Screen.Recording.2026-10-21.at.9.58.06.PM.mov

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

One or more issues must be addressed before approval.

1 open issue
What changed in this PR

Adds optional non-dismissable toast support across single and list views.

Changes:

  • Adds the dismissable notification flag and helper arguments.
  • Hides individual dismiss buttons and excludes non-dismissable items from bulk dismissal.
  • Adds Storybook and component tests.
File Description
src/​components/​Notifications/​ToastNotification/​ToastNotificationProvider.tsx Updated as part of this pull request.
src/​components/​Notifications/​ToastNotification/​ToastNotificationList.tsx Updated as part of this pull request.
src/​components/​Notifications/​ToastNotification/​ToastNotification.tsx Updated as part of this pull request.
src/​components/​Notifications/​ToastNotification/​ToastNotification.test.tsx Updated as part of this pull request.
src/​components/​Notifications/​ToastNotification/​ToastNotification.stories.tsx Updated as part of this pull request.

Review effort: Lite

Comment thread src/components/Notifications/ToastNotification/ToastNotificationList.tsx Outdated

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

Some whitespace can be removed from tests and one suggestion to retain functionality. Triggering copilot review once again as I have some doubts regarding another code block.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The only noted gap is a minor provider-level test enhancement and does not block approval.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@Ninfa-Jeon Ninfa-Jeon 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, thanks!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation and behavior are covered across the reviewed components; the remaining provider-level integration coverage is a minor non-blocking nit.

No open issues 🎉

Review effort: Lite

@ndv99
ndv99 merged commit 32b947e into canonical:main Oct 23, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

4 participants