Global Overlay Manager (Context + Reducer)
Centralize overlays using Context + Reducer: a single store for modals/toasts with simple actions callable from anywhere.
Why a global manager?
Goal: Control all overlays from one place.
- Context exposes actions
- Reducer manages state
- Modals stack; toasts queue
Design rules
- Keep a single store for overlays
- Expose openModal/closeTop/showToast
- Render layers via a Portal
- Keep a11y basics: role="dialog", Escape/backdrop
All lessons in this course
- Portals, Focus Trap, Escape-to-Close
- Global Overlay Manager (Context + Reducer)
- Announcements for Accessibility (aria-live)