Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: stacked modals missing backdrop and box-shadow (incl. repro) #23278

Closed
bitflower opened this issue May 6, 2021 · 7 comments
Closed

bug: stacked modals missing backdrop and box-shadow (incl. repro) #23278

bitflower opened this issue May 6, 2021 · 7 comments
Labels

Comments

@bitflower
Copy link
Contributor

bitflower commented May 6, 2021

Bug Report

Ionic version:
[x] 5.5.6

Current behavior:
Stacking modals in ionic/[email protected] I’m having issue with the backdrop and box-shadow of the 2nd modal. In my case it’s a “confirm dialog” on top of a “file gallery”. Looking at the HTML layering and CSS architecture all seems fine. z-indexes are in place just right. This is how it looks like:

image

I was able to fake the box-shadow on the small modal. But still I’m missing the covering effect of the backdrop over the 1. modal content. The rendered DOM:

image (1)

When I move the 2nd modal up in the DOM in the DevTools I get a bit closer but losing the shadow in the “big” modal:

image (2)

Outcome:

image (3)

I fiddled with all kinds of z-index variations without luck.

Expected behavior:

  • modal 1 is covered with backdrop of modal 2
  • modal 2 has box-shadow

Steps to reproduce:
See repo: https://github.com/bitflower/modal-test

npm i
npm start

Click button "Open Profile in Modal"
Click button "Delete"

Related code:
https://github.com/bitflower/modal-test

Ionic info:

This is a pure Stencil app. No framework. I never use the CLI hence the version below doesn't matter.

Ionic:

   Ionic CLI : 5.4.16

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v14.8.0
   npm    : 6.14.11
   OS     : macOS Catalina
@ionitron-bot ionitron-bot bot added the triage label May 6, 2021
@bitflower bitflower changed the title bug: stacked modals are missing backdrop and box-shadow bug: stacked modals missing backdrop and box-shadow (incl. repro) May 6, 2021
@DwieDima
Copy link
Contributor

DwieDima commented May 6, 2021

this was added on purpose, heres the issue

#20800

you can add backdrop opacity by providing --backdrop-opacity: 0.3; to your modal.

@liamdebeasi
Copy link
Contributor

Thanks for the issue. I am going to close this as this is not a bug in Ionic Framework. This is intentional as pushing many modals would cause the content behind the modal to become very dark otherwise. To disable this behavior, you can set --backdrop-opacity to a non-zero value as mentioned in #23278 (comment).

@bitflower
Copy link
Contributor Author

Hi guys, thanks for the quick reply. Just tried and while it solves the covering of the previous modal content it doesn't for the shadow on the 2nd modal box. The 2nd issue also persists: the shadow in the previous modal gets lost. See the result:

Bildschirmfoto 2021-05-06 um 15 13 09

Just let me know if this an edge you maybe think of solving. If so I could get my hands dirty and try to provide a PR. If not I'll probably solve it "locally".

Thanks!

@liamdebeasi
Copy link
Contributor

Thanks for the follow up. So we typically work under the assumption that stacked modals are the same size and only show the shadow on the first modal, otherwise you would run into the same problem as with stacking the backdrops. The solution here is to set the --box-shadow var on the small modal as well.

Here are the exact values we use for MD mode:

--box-shadow: 0 28px 48px rgba(0, 0, 0, 0.4);
--backdrop-opacity: var(--ion-backdrop-opacity, 0.32);

@bitflower
Copy link
Contributor Author

Wow, @liamdebeasi I'm impressed! I'll see what I can come up with for the docs to represent this. As a minimum contribution!

@bitflower
Copy link
Contributor Author

Here you go: #23279

@ionitron-bot
Copy link

ionitron-bot bot commented Jun 5, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jun 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants