ionic-team / ionic-team/ionic-framework

bug: Backdrop only visible for first modal

未关闭
#29,815 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
package: core type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v8.x

### Current Behavior

It seems that the backdrop of e.g. modal is only visible for the first modal. This makes neasted modals look confusing. It's not about fullscreen modals.

### Expected Behavior

In ealier versions the backdrops were visible for each modal. I guess this has been changed, because multiple modals with each have it's own backdrop visible, leads to darker and darker background (up to black).

But I would rather show the last backdrop and not the first one. Otherwise, the nested modals are on top of each other and it is difficult to see what the topmost modal is.

My current workaround is:

```scss
ion-modal.modal-default.show-modal:last-of-type {
// I set --ion-backdrop-opacity in variables theme dependent.
--backdrop-opacity: var(--ion-backdrop-opacity, 0.33) !important;
}
```

### Steps to Reproduce

1. Create modals; not fullscreen; different sizes.
2. In a modal, open another.
3. See that the backdrop is only visible on the first modal. Not on the second one.

### Code Reproduction URL

https://codepen.io/fudom/pen/zYVLXxO

### Ionic Info

No Ionic repo (no ionic info available). But it does not matter in this case. I use Angular with Ionic 8.2.x. But see CodePen too.

### Additional Information

With my workaround and proposal, you see this effect.

| Before | After |
| --- | --- |
|![before](https://github.com/user-attachments/assets/3d2ad892-5038-41c3-a6ea-7cf81758e283)|![after](https://github.com/user-attachments/assets/100058e5-3815-4fd5-a7c9-bae13642889b)|

@liamdebeasi cc

贡献指南

打开贡献指南

调研方向

Start with the CodePen reproduction and the modal backdrop behavior for nested, non-fullscreen modals. Trace the modal and backdrop implementation to determine why only the first backdrop is visible; done means the topmost nested modal shows its backdrop without affecting fullscreen behavior, with the reproduction covered by an appropriate regression test.

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, css, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
62/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。