IncentroBA / Snackbar

UI pattern from Material design. Snackbars provide brief messages about app processes at the bottom of the screen
MIT License
0 stars 0 forks source link

Sending a new snackbar message before the previous one is closed #1

Open jacobboer opened 10 months ago

jacobboer commented 10 months ago

We have created this setup with a snackbar object linked to session which contains the message and the isOpen boolean. In some cases with fast users the next message is already coming before the autoclose is suspended.

In that case I change the snackbarobject, set open to false, refresh it in the client and immediately after change the text to the new text, set open to true again and refresh it. In all cases the new text is shown nicely, however I do not get a new start of the 5 seconds, it just closes it after the remaining time from the initial isOpen... So if after 3 seconds the new message is generated it is shown only 2 seconds.... I tried with deleting the previous snackbar object etc. but I cannot get it working.

Tried some tweaks in the JS code (setting the timer on some other places) but that didnt work... Would be nice if you have a solution for that.

Nice to have: show not only one snackbar message, but all the ones that are active but thats a whole other approach...

iamrob-nl commented 10 months ago

Thanks for your feedback. I understand that you want to use the Snackbar widget to show more than one at a time. In my opinion this is however not a suitable UI pattern for this scenario.

I would suggest the Feedback toast notification for such a scenario. These are meant to be used with more than just one at a time.

Based on the Material design I would say a snackbar should only display one at a time.

Would this be a solution for you?

jacobboer commented 10 months ago

The issue/bug is about one at a time.

The Nice to have indeed could be a misfit for snackbar.

Op wo 13 dec. 2023 08:38 schreef iamrob @.***>:

Thanks for your feedback. I understand that you want to use the Snackbar widget to show more than one at a time. In my opinion this is however not a suitable UI pattern for this scenario.

I would suggest the Feedback toast notification https://marketplace.mendix.com/link/component/111533 for such a scenario. These are meant to be used with more than just one at a time.

Based on the Material design https://m3.material.io/components/snackbar/overview I would say a snackbar should only display one at a time.

Would this be a solution for you?

— Reply to this email directly, view it on GitHub https://github.com/IncentroBA/Snackbar/issues/1#issuecomment-1853407397, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ56GMIO22LTXP3JMKHLPWDYJFLQJAVCNFSM6AAAAABARZDBN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJTGQYDOMZZG4 . You are receiving this because you authored the thread.Message ID: @.***>

iamrob-nl commented 10 months ago

I think the best usage in this scenario would be to have the widget two times and give them each their own openState boolean. When one is being set to false, the other can go to true.

image

When testing on a local environment, both snackbars will have their own timer going.

Is this a solution for you?