cengage / react-magma

https://react-magma.cengage.com
MIT License
21 stars 13 forks source link

Toast: The ability to programmatically dismiss a dynamic toast #1521

Open artemtrusov-cengage opened 1 week ago

artemtrusov-cengage commented 1 week ago

The toaster component can automatically disappear after a certain time. During development, we ran into a problem because we have two places where we use the toaster: one on the main page and one in a modal window. The issue is that when the toaster shows up in one window and doesn’t close in time, if we open the other window, the timer resets, and the toaster appears again in the second window with a new timer. This keeps happening when we switch between the windows.

To fix this, we need the option to manually close the toaster so that we can dismiss it when one of the windows is closed.

silvalaura commented 1 week ago

@artemtrusov-cengage We currently support disableAutoDismiss so the user has to manually close them themselves, but are you requesting a way to programmatically close an open Toast so that engineers can close them when a new window is opened?

artemtrusov-cengage commented 1 week ago

@silvalaura Yes, we need a way for engineers to programmatically close an open toast. Currently, we support disableAutoDismiss, which requires users to close the toasts manually. However, it would be beneficial to have the capability to automatically close a toast when a new window is opened.

silvalaura commented 1 week ago

@orion-cengage Any accessibility concerns about supporting this?

orion-cengage commented 1 week ago

Yeah probably. I would recommend they run this by Perkins or the Cengage a11y team before we do anything to the component for this. So many ways this could be handled without toasts.