Decathlon / vitamin-web

Decathlon Design System UI components for web applications
https://decathlon.github.io/vitamin-web
Apache License 2.0
282 stars 76 forks source link

feat(@vtmn/css): be able to choose the duration of display for snackbar (& toast) #1460

Open Z26PGOBL opened 1 year ago

Z26PGOBL commented 1 year ago

Describe the bug

We are implementing the snackbar in our application and for accessibility purpose our UI/UX team recommended that the snackbar should be displayed for 8 seconds. We see that the duration is hardcoded in the --vtmn-animation_overlay custom property of animations design-tokens so we manage to override it, but we think it would be good to be able to set it more "gracefully".

Capture d’écran 2023-09-07 à 15 44 19

Steps to reproduce

  1. Go to https://decathlon.github.io/vitamin-web/@vtmn/showcase-css/?path=/docs/components-overlays-snackbar--demo
  2. Click on a demo button
  3. See the snackbar appear and disappear after about 5 seconds

Expected behavior We should be able to set the duration time

lauthieb commented 1 year ago

Hello Pauline,

Thanks for this issue and your proposition.

Normally, you can totally control the display duration of the VtmnSnackbar on your own. Here is an example I made with @vtmn/react: https://stackblitz.com/edit/vitejs-vite-rnupye?file=src%2FApp.jsx

CleanShot 2023-08-23 at 15 57 48

Z26PGOBL commented 1 year ago

it works if you put a value smaller than 4,5 second, but if you put 8000 as timeout value the snackbar will still disappear after 4,5 second and not 8. Furthermore, with 1s as time out, the fade-out and vanish animation are not launched

lauthieb commented 1 year ago

Hi @Z26PGOBL, oh you're right, sorry! That's a good catch. We take this feedback for our new implementation of Vitamin (currently inner source) & I've put this issue with "community" label. Feel free to contribute, I'll be there to review. Thank you!