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.

feat(modal): enable propagation on underlying page

See original GitHub issue

Feature Request

Ionic version:

[x] 5.1.0

Describe the Feature Request

It would be great if when opening a modal you could still edit the underlying page without the opened modal closing. This is especially useful if you define a modal that has a height of less than 100%.

Describe Preferred Solution

The modal controller could be extended by the property: propagate: boolean.

.ts

  public async onOpenModal() {
    const modal = await this.modalController.create({
      component: ModalPage,
      propagate: true,
      cssClass: 'sheet-modal',
    });
    return await modal.present();
  }

.scss

.sheet-modal {
  position: absolute;
  display: block;
  top: calc(100% - 200px);
  --height: 200px;
}

Additional Context

I have managed to create a sheet modal, but not that the underlying page can be edited:

.ts

  public async onOpenModal() {
    const modal = await this.modalController.create({
      component: ModalPage,
      showBackdrop: false,
      backdropDismiss: false,
      cssClass: 'sheet-modal',
    });
    return await modal.present();
  }

.scss

.sheet-modal .modal-wrapper {
  position: absolute;
  display: block;
  top: calc(100% - (200px));
  --height: 200px;
  --border-radius: 10px 10px 0px 0px;
  --box-shadow: 0px -0.5px 2px 1px rgba(0, 0, 0, 0.1);
}

result the goal of this example is to be able to continue scrolling the map while the modal remains open. Currently, only the modal content can be edited

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
DwieDimacommented, May 13, 2020

Oh wow, that simple. Now its working as expected! Took me hours!

Thanks a lot!

1reaction
liamdebeasicommented, May 13, 2020

Your original example provides a custom CSS class sheet-modal, so just target that instead:

.sheet-modal,
.sheet-modal ion-backdrop {
  pointer-events: none;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ion-modal - Can't enable touch propagation on underlying page
I am trying to let users interact with the underlying page interactable even while the modal is opened. This would be useful on...
Read more >
Building a modal module for React with React-Router
In this article, we'll discuss the various aspects of modals and identify solutions to satisfy the requirements that come with creating dynamic ...
Read more >
Prevent Page Scrolling When a Modal is Open | CSS-Tricks
You open a modal, scroll through it, close it, and wind up somewhere else on the page than you were when you opened...
Read more >
Event Propagation with a React Modal Window - Medium
One way to allow a background onClick to close the modal, but prevent a window click event from bubbling up to the background...
Read more >
How to create an efficient Modal component in React using ...
A modal is a dialog box/popup window that is displayed on top of the current page. You must have used pop-ups and notifications...
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