ui icon indicating copy to clipboard operation
ui copied to clipboard

Toast not displayed correclty on mobile

Open sebiwi opened this issue 3 years ago • 5 comments

Hello,

The toast component is not displayed correctly on my project when on mobile.

When using the browser, it works fine:

Screenshot 2023-11-03 at 14 35 25

Nevertheless, as soon as I switch to mobile navigation, the toast is displayed just outside of frame:

Screenshot 2023-11-03 at 14 35 10

Am I doing something wrong?

PS: Also, I'm using the Toaster component in my response, otherwise the toast never shows up. The documentation doesn't say this step is necessary, so maybe it's not up to date?

Thanks!

sebiwi avatar Nov 07 '23 15:11 sebiwi

Have you tried using another browser? Sometimes old mobile browsers just sucks, also Safari does not support anything... i faced the same probleme with the handmade pop-over component on iphone for some reason it just dont work

TA9IO avatar Nov 08 '23 12:11 TA9IO

@sebiwi I had the same issue. I moved the <Toaster /> component outside of my <main /> in the layout file and now it's working correctly.

TikiCat7 avatar Nov 10 '23 06:11 TikiCat7

Thanks! That worked like a charm!

Does anyone knows what the root cause of this issue is? Should it be documented?

sebiwi avatar Nov 13 '23 15:11 sebiwi

这个问题我也发现了,浏览器在不同的宽度下效果有所区别。 大屏xl以上是没有问题的,md左右的情况是显示了一个边缘。小屏尤其是手机就看不到了,也看不到错误输出。 我们可以找一下引入的组件,尽可能的去找样式控制的部分。 image 可以看到ToastViewport部分, image 这里有控制样式的内容,我们尝试修改可以看到在小屏下有作用。 "fixed bottom-0 z-[100] flex max-h-screen w-4/5 md:w-1/2 xl:w-1/4 flex-col-reverse p-4 right-0", 感觉是对sm的支持有问题,小屏情况并没有按sm:的有效执行。 我们尝试改一下这块的处理,如我提供的代码,效果如下: 小屏: image 中屏: image 大屏: image

我目前只能在这里解决,具体为何原来的有问题需要深入组件实现的部分才清楚。目前按这种方式可以展示出来。如果那位大神发现更好的方式处理,可以告诉我。

dong20191111 avatar Dec 23 '23 09:12 dong20191111

image

Moving the Toaster above the sidebar and main did the magic.

raymond-UI avatar Jan 08 '25 17:01 raymond-UI