Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification toast disappears sooner than setTimout #948

Closed
VictoriaStefanikova opened this issue Mar 17, 2022 · 2 comments
Closed

Notification toast disappears sooner than setTimout #948

VictoriaStefanikova opened this issue Mar 17, 2022 · 2 comments
Assignees

Comments

@VictoriaStefanikova
Copy link

Hi! I have replaced notification message component in my code with notification toast.
Solution with notification-message scale component

<div *ngFor="let notification of notifications">
  <scale-notification-message
    variant="{{ notification.variant }}"
    dismissible
    opened
  >
    {{ notification.message }}
  </scale-notification-message>
</div>

Solution with notification-toast scale component

<div *ngFor="let notification of notifications">
  <scale-notification-toast variant="{{ notification.variant }}" opened animated>
    <p slot="header">{{ notification.message }}</p>
  </scale-notification-toast>
</div>

I also have a functionality in the ts file where I set timeout for each notification for 5 seconds:

private addNotification(notification: Notification): void {
    this.notifications.push(notification);
    setTimeout(() => {
      this.closeNotification(notification);
    }, 5000);
  }

I see problem with notification-toast:
1. Whenever there is an action in the application that triggers showing notification-toast, it appears for just a split second - it only flashes on the screen, although the component is visible for 5 seconds when inspecting through developer tools.
2. I think nice feature for notification toast would be having autoHideDuration attribute as exist for notification message already

@verdody
Copy link

verdody commented Jun 1, 2023

I want to raise an issue that is related to the problem mentioned above.
I have defined the notification-toast component like this:

<div *ngFor="let notification of notifications">
  <scale-notification-toast variant="{{ notification.variant }}" opened animated>
    <p slot="header">{{ notification.message }}</p>
  </scale-notification-toast>
</div>

If I have multiple notification toasts, I want them to stack below each other, not on top of each other.
Currently, they are always placed on top of each other. I found out, that this is because of the class in the shadow DOM, that defines:

.notification-toast {
...
position: fixed;
...
}

To solve my issue, I would need to change it to position: relative. However I cannot target it like this:
scale-notification-toast::part(base) I need to target the class. Can you please suggest me how can I achieve this?
Or is there any other way how to set this behavior?

Thank you.

@marvinLaubenstein
Copy link
Collaborator

Hi @verdody, we'll take a look 🙂

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 a pull request may close this issue.

3 participants