Build an accessible modal/dialog system using React 19 portals with focus trapping, keyboard navigation, and scroll locking.
Act as a React 19 accessibility expert. Create a portal-based modal system for [MODAL_TYPES]. Implement focus trap cycling through [FOCUSABLE_ELEMENTS]. Add Escape key dismissal and click-outside for [DISMISS_BEHAVIOR]. Lock body scroll and manage aria-hidden on [BACKGROUND_CONTENT]. Support stacked modals with [Z_INDEX_STRATEGY].
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Llama 4 Maverick.
Specify modal types, focusable elements, dismiss behavior preference, background content selectors, and z-index strategy.
Initial release
Sign in and download this prompt to leave a review.