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: Backdrop only visible for first modal #29815

Open
3 tasks done
fudom opened this issue Aug 29, 2024 · 3 comments
Open
3 tasks done

bug: Backdrop only visible for first modal #29815

fudom opened this issue Aug 29, 2024 · 3 comments
Labels

Comments

@fudom
Copy link

fudom commented Aug 29, 2024

Prerequisites

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:

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 after

@liamdebeasi cc

@ionitron-bot ionitron-bot bot added the triage label Aug 29, 2024
@liamdebeasi
Copy link
Contributor

Hi,

I don't work for Ionic anymore, so you don't need to tag me. However, I will note that this behavior is intentional. Without it, the modal backdrop would get progressively darker as more modals stacked on top of each other. This is most noticeable on tablet viewports with modals that are the same size.

@fudom
Copy link
Author

fudom commented Sep 3, 2024

Ok, I was just wondering why there hasn't been any activity lately and thought I'd reach out to you since I believe you implemented it. I have already noticed some changes in the project. It's probably just winding down. Anyway...

Yes, the background gets darker with each stacked modal. However, this is only a problem if you have a lot of modals stacked, which is very rare in real apps. I would rather show the last backdrop, not the first one, otherwise it causes the problem shown in my first post. This cannot be intentional if modals can no longer be recognized.

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Sep 3, 2024

There might be a way to make this behavior a prop or something that devs can toggle. You could check with the team and see if this is a feature they'd be willing to consider. If they are open to it, I think this could be a great community contribution if you're interested!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants