wobsoriano/svelte-sonner

multi-line promise toasts change height on hover when using expand

Closed this issue · 17 comments

<Toaster expand={true} />
toast.promise(Promise.resolve(), { success: 'This my very very very very very very very very very very very very very very very very very very very very long and descriptive promise toast!!!' })

when hovering over these toasts, they will change height as their top paddings will disappear, causing weird layout shifts, it looks very ugly

+1 on this for me. Will be awesome to get this one fixed since this is such a beautiful modal implementation.

WIll look into it this week

Hey y'all, can any of you provide a demo of this? I can't replicate / notice the shift

@wobsoriano hey sorry, this error report is inaccurate, the reproduction steps are actually as follows:

<Toaster expand={true} />
toast.promise(Promise.resolve(), { success: 'This my very very very very very very very very very very very very very very very very very very very very long and descriptive promise toast!!!' })

it happens only with promise toasts, not normal toasts

Are you still getting it with the latest version @ThaUnknown?

@wobsoriano seem like I'm still getting this issue on 0.3.6 sadly when there's only one toast item:

Screen.Recording.2023-11-27.at.10.08.04.mov

I'm not able to reproduce with the latest version, is anyone able to reproduce or should this be closed?

I can still reproduce this, I'll make some minimal test case later

repro.zip

this issue happens when the error/success has more lines than the pending text, I've attached a stupidly simple reproduction case, which runs on body click

you can simply paste the files into stack blitz yourself

Thanks for the repro @jakob-kruse, will look into this!

I tried to fix this myself by failed. I think i understand the reason though.

When Toast.svelte mounts it calculates the initialHeight. Code

This will be the height of the loading message, which would be too small for the success/error message.

The height should be updated every time the type / content of the toast changes.

Hope this helps, @huntabyte!

This definitely helps!

This is a very beautiful tool and certainly elevates any Svelte app's experience! 10/10 except for this one small issue, is there a temporary fix that we can use?