react-magma icon indicating copy to clipboard operation
react-magma copied to clipboard

Toast: The ability to programmatically dismiss a dynamic toast

Open artemtrusov-cengage opened this issue 1 year ago • 4 comments

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.

artemtrusov-cengage avatar Oct 30 '24 15:10 artemtrusov-cengage

@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?

silvalaura avatar Oct 30 '24 15:10 silvalaura

@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.

artemtrusov-cengage avatar Oct 30 '24 16:10 artemtrusov-cengage

@orion-cengage Any accessibility concerns about supporting this?

silvalaura avatar Oct 30 '24 16:10 silvalaura

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.

orion-cengage avatar Oct 30 '24 18:10 orion-cengage