Optimized for: Gemini / ChatGPT / Claude
Advanced AI Prompt for Radix UI Nested Modal Focus Management
Use this engineered prompt to drastically optimize your workflow and output.
Required Variables
- ✦
[NESTING_DEPTH] - ✦
[TRIGGER_ELEMENTS] - ✦
[STYLING_FRAMEWORK]
radix-ui-nested-modal-focus-management.txt
Act as a Senior Frontend Architect specializing in accessibility. Develop a production-ready React implementation using Radix UI Dialog that supports [NESTING_DEPTH] levels of depth. You must solve the 'Focus Trap within Focus Trap' problem specifically for [TRIGGER_ELEMENTS]. Ensure that when the top-most modal closes, focus is restored to the immediate parent's trigger, not the initial page trigger. Use [STYLING_FRAMEWORK] for the UI. Include ARIA-labels, role descriptions, and a technical explanation of how the FocusScope component manages the stack.
Example Output
"The AI will generate a recursive React component structure using Radix's Dialog.Root and Dialog.Content, implementing a custom hook to track focus history across multiple portal levels."