Skip to content

Flashes don't disappear after push_navigate #43

@PJUllrich

Description

@PJUllrich

Hey there,

it appears that flash messages don't disappear like toasts do, which makes for a somewhat confusing UX. I tested LiveToast in my project and if I stay in one LiveView and show a toast, it disappears after 6 seconds as expected. However, if I use put_toast/3 followed by a push_navigate/2, a Flash message with data-component="flash" appears which looks exactly like my toast, but it doesn't disappear after 6s.

After a morning of debugging this, it appears that LiveToast doesn't auto-hide flash messages, only toasts.

Flashes have a data-duration="0" by default, which means they'll stay indefinitely.

But even if I could set a duration for them, the JS part would ignore them:

if (isFlash(this.el)) {

My assumption is that LiveToast doesn't remove flashes because LiveView also doesn't do that. However, this becomes confusing when a Toast does disappear, but a Flash does not, even though they look the same. May I suggest that you hide Flashes just like you hide Toasts? That'd be much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions