From c98de56f1ee42b2fe3bdf535947bfbd33ca4239a Mon Sep 17 00:00:00 2001 From: Tommmaso Menga Date: Wed, 27 Mar 2024 09:26:41 +0100 Subject: [PATCH] feat(notification): disable open animation by default --- src/components/notification/notification.scss | 5 +++++ src/components/notification/notification.stories.ts | 1 + src/components/notification/readme.md | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/components/notification/notification.scss b/src/components/notification/notification.scss index 68ce6a7f150..11b783fa43c 100644 --- a/src/components/notification/notification.scss +++ b/src/components/notification/notification.scss @@ -40,6 +40,11 @@ --sbb-focus-outline-color: var(--sbb-focus-outline-color-default); } +// By default, the open animation is disabled +:host([data-state='opening']:not(.sbb-animate)) { + @include sbb.disable-animation; +} + :host(:is([data-state='opened'], [data-state='opening'])) { --sbb-notification-opacity: 1; --sbb-notification-max-height: calc( diff --git a/src/components/notification/notification.stories.ts b/src/components/notification/notification.stories.ts index 2d45cb10aa9..b1b026f6d07 100644 --- a/src/components/notification/notification.stories.ts +++ b/src/components/notification/notification.stories.ts @@ -49,6 +49,7 @@ const appendNotification = (event: Event, args: Args): void => { '--sbb-notification-margin', '0 0 var(--sbb-spacing-fixed-4x) 0', ); + newNotification.setAttribute('class', 'sbb-animate'); newNotification.titleContent = args['title-content']; newNotification.type = args['type']; newNotification.readonly = args['readonly']; diff --git a/src/components/notification/readme.md b/src/components/notification/readme.md index f4a1167002c..7a75980e735 100644 --- a/src/components/notification/readme.md +++ b/src/components/notification/readme.md @@ -73,6 +73,8 @@ This ensures that users who rely on screen readers are promptly informed of any ## Animation +By default, the `sbb-notification` does not have an open animation. Add the `.sbb-animate` class to the element to enable it. + Add the `sbb-disable-animation` class to disable animation and transition effects for the element and all its children.