Chakra UI ToastContainer: Missing maxCount configuration to limit concurrent toasts
0 reputation · 25 Nov 2023, 21:31 UTC
Goal: prevent ToastContainer from displaying an unbounded number of toast notifications that can clutter the interface and overwhelm assistive technologies.
In Chakra UI v2.6+, each toast is rendered as a separate portal element and the underlying zustand store does not provide a built‑in mechanism to automatically discard older toasts when a limit is exceeded. Developers must manually track toast IDs and invoke closeToast or rely on duration and isClosable props, which can lead to inconsistent behavior when toasts are triggered rapidly.
Should Chakra UI expose a maxCount prop on ToastContainer? Would adding such a prop conflict with the current zustand‑based store design? How could a limit be implemented without affecting screen‑reader announcements or causing memory leaks?