question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ionic 4 Modal not appearing with transparent background

See original GitHub issue

Ionic version:

[x] 4.x

I’m submitting a …

[ ] bug report [ ] feature request

Current behavior:

My Modal is appearing with a solid background/Overlay

Expected behavior:

I want my modal to appear with a transparent background/overlay Steps to reproduce:

Related code:

insert short code snippets here
modal.scss  :
 .main_view{
      background: transparent;
    }
    .overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      opacity: .5;
      background-color: #333;
      
    }

modal.html:
<ion-content padding class="main_view">
  <div class="overlay" (click)="dismiss()"></div>
  <div class="modal_content">
    <div class="circle"></div>
    <div class="modal-content">
        <ion-progress-bar type="indeterminate"></ion-progress-bar>
  <h2>Waiting for Driver confirmation</h2>
    </div>
  </div>
  
</ion-content>

and .ts to invoke modal in my app:

  async confirm(){
    
    const modal = await this.modalCtrl.create({
      component: ModalPage,
      // componentProps: {value : "test"},
    });
    await modal.present();
    modal.onDidDismiss().then(res => {
      console.log(JSON.stringify(res))
      this.isModalDismiss = res.data.isDismiss;
      console.log(this.isModalDismiss)
      this.routeDriver();
    });
  }

Other information:

Ionic info:

insert the output from ionic info here

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
niravtrivedi21commented, Aug 11, 2021

Hi @ionic-team, I am facing the same issue in Ionic 5, can you please guide me to resolve this issue?

1reaction
ae-assekecommented, Aug 10, 2019

to have a good transparent (ionic 4), I made this

    • modal.scss { ion-content { –ion-background-color : transparent !important; }’
    • global.scss { modal-transparency { –background: transparent!important }
    • and I call modal like this async confirm(){ const modal = await this.modalCtrl.create({ … cssClass: ‘modal-transparency’ … });

I hope it can help u.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic 4 modal with transparent background doesn't work
I try to make a modal with a transparent background, but I can't find the solution, the solutions provided in the forum do...
Read more >
Ionic - V5 transparent modal not working
The idea is to create a semi transparent unlock slider modal. I tried this solution: Ionic-v4 how to make transparent modal. And this...
Read more >
4 reasons your z-index isn't working (and how to fix it)
Since the content element is now unpositioned, it will no longer limit the modal's z-index value. So the open modal will be positioned...
Read more >
Ionic Modal With Top Circle - StackBlitz
Starter project for Ionic apps that exports to the Ionic CLI. ... @media not all and (min-height: 600px) and ... background: transparent;. }...
Read more >
Modal backdrop: static not allowing clicks without closing t
I have tried [config]={backdrop: false, ignoreBackdropClick: true} so far but even if it removes the backdrop and prevents the closing, I am not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found