[RAC] Stacked modals: closing overlay dismisses the one beneath it during its exit animation
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- react, typescript
调研方向
从 packages/react-aria/src/overlays/useOverlay.ts 开始,重点查看 visibleOverlays 堆栈和外部交互处理,然后比较 packages/react-aria-components/src/Modal.tsx 中的挂载行为。在链接的 CodeSandbox 中复现模态框堆叠的情况;完成标准是,正在退出的顶部模态框在卸载之前一直是交互的所有者,因此底层模态框不会被关闭。
由索引模型根据 Issue 内容生成。
描述
Provide a general summary of the issue here
With stacked modals (a Modal/ModalOverlay opened on top of another), closing the top modal while it has an exit animation can cause the modal underneath it to be dismissed by an outside-click that actually landed on the still-animating top modal.
🤔 Expected Behavior?
A modal that's still mounted and visually on top (mid exit-animation) should keep owning pointer interactions that land on it. Only a click genuinely outside all modals should dismiss the one beneath.
😯 Current Behavior
useOverlay only lets the topmost entry in its visibleOverlays stack react to outside interactions, but stack membership is keyed on isOpen — an overlay is spliced out the instant it starts closing:
react-aria-components, however, keeps the closing overlay mounted (backdrop + content, still on top, still hit-testable) until its exit animation finishes:
So during the exit animation the top overlay is gone from the stack but still physically covers the one beneath. A pointer interaction landing on it is, for the overlay beneath, "outside", and since that overlay is now visibleOverlays[last], the handler fires onHide() and closes it:
The "only the topmost visible overlay reacts to outside interactions" invariant is silently broken for any overlay mid exit-animation.
💁 Possible Solution
Keep an overlay in visibleOverlays until it actually unmounts, so it stays topmost as long as it's physically on top.
🔦 Context
We have a picker modal inside a dialog (pick an item, the picker closes, click something on the dialog, which lands on the exiting picker). Worked around it with a shouldCloseOnInteractOutside on the outer modal, ignoring interactions whose target is inside a modal.
🖥️ Steps to Reproduce
- Stack dismissable
ModalOverlayA, thenBon top, both withisExitingexit animations. - Close
B - While
Bis closing, click again Awill close because clicking on the exitingBis considered outsideA
Code sandbox: https://codesandbox.io/p/sandbox/dvnjy5
https://github.com/user-attachments/assets/58b286f1-6ab7-40cf-9491-c0efb822a848
Version
react-aria-components 1.19.0 (react-aria 3.50.0)
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
macOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
- 主要语言
- TypeScript
- 星标
- 16k
- 派生
- 1.6k
- 平均合并
- 3 天 9 小时
- 30 天内合并 PR
- 45
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
adobe/react-spectrum 的其他 Issue
-
accessibility bug PreviewTrigger
难度 2/5 1-3 小时 新手友好度 76/100
adobe/react-spectrum#10917 · 1 条评论 ·
维护者通常 1 天内回复
-
S2 quiet Picker menu is always 192px wide: its width calc() has no unit可能已有人在做 @darshpatel1052 于 1 天前认领。 未关闭waiting on author
难度 2/5 1 小时以内 新手友好度 88/100
adobe/react-spectrum#10909 · 3 条评论 ·
维护者通常 1 天内回复
-
DatePicker omits timezone for initially empty fields despite zoned placeholderValue可能已有人在做 @mrlexcoder 于 2 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
adobe/react-spectrum#10900 · 2 条评论 ·
维护者通常 1 天内回复
-
Separator adds a redundant role="separator" to its default <hr>可能已有人在做 @Janani-bn 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
adobe/react-spectrum#10894 · 2 条评论 ·
维护者通常 1 天内回复
-
ComboBox with selectionMode="multiple": Cmd/Ctrl+A does nothing while the popover is open可能已有人在做 @mangeshraut712 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
adobe/react-spectrum#10866 ·
维护者通常 1 天内回复
查看 adobe/react-spectrum 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
Open-Earth-Foundation/CityCatalyst#3399 ·
维护者通常 2 天内回复
-
userReport
难度 1/5 1 小时以内 新手友好度 72/100
nkprasad12/morcus-net#631 ·
维护者通常 1 天内回复
-
fix(app): fail closed if GetGeneralSetting fails during initialization可能已有人在做 @kalavt 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
nekko-labs/nekko-agent#1756 ·
维护者通常 1 天内回复
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复