Parent modal overlaps nested modal
- Dominant language
- TypeScript
- Stars
- 15.9k
- Forks
- 1.6k
- Avg merge
- 3d 9m
- Merged PRs (30d)
- 59
Description
### Provide a general summary of the issue here
Parent modal overlaps nested child modal on page reload when modals are rendered via routing.
### 🤔 Expected Behavior?
On page reload at a URL corresponding to a nested modal, the child modal should appear on top of the parent modal, with the correct stacking order. The topmost modal should be fully visible and interactive.
### 😯 Current Behavior
This issue occurs when nested modals are conditionally rendered based on the current URL path. When a user navigates directly to, or refreshes the page on, a URL that should display a nested modal, the parent modal incorrectly appears in front of the child modal. This makes the child modal inaccessible, and the parent modal also becomes unresponsive to clicks. This stacking issue does not occur when navigating to the modals sequentially via user interaction (e.g., clicking buttons).
React router is used to display the actual use case. The problem still persists with no routing, just using 2 nested open modals.
### 💁 Possible Solution
_No response_
### 🔦 Context
_No response_
### 🖥️ Steps to Reproduce
https://codesandbox.io/p/sandbox/react-aria-nested-modals-bug-vqqjmm
### Version
react-aria-components - 1.12.1
### What browsers are you seeing the problem on?
Chrome, Safari
### If other, please specify.
_No response_
### What operating system are you using?
macOS
### 🧢 Your Company/Team
_No response_
### 🕷 Tracking Issue
_No response_
Contributor guide
Research direction
Start with the linked CodeSandbox reproduction and inspect how the two nested open modals are rendered on direct load versus sequential navigation. The issue reports the behavior in react-aria-components 1.12.1; done means the child modal appears above the parent after a reload and is fully visible and interactive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 49/100