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

suggest enable modal-controller,toast-controller dismiss when click 「back button」 in browser #15422

Closed
cdllqos opened this issue Aug 31, 2018 · 5 comments
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement

Comments

@cdllqos
Copy link

cdllqos commented Aug 31, 2018

Feature Request

Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

   ionic (Ionic CLI)          : 4.1.0
   Ionic Framework            : @ionic/angular 4.0.0-beta.6
   @angular-devkit/core       : 0.7.5
   @angular-devkit/schematics : 0.7.5
   @angular/cli               : 6.1.5
   @ionic/ng-toolkit          : 1.0.7
   @ionic/schematics-angular  : 1.0.5

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (0 plugins total)

System:

   ios-sim : 6.1.3
   NodeJS  : v8.11.3 (/usr/local/bin/node)
   npm     : 5.10.0
   OS      : macOS High Sierra
   Xcode   : Xcode 9.4.1 Build version 9F2000

Environment:

   ANDROID_HOME : not set

Describe the Feature Request
I use modal-controller and toast-controller in android env,I tap 「back button」and the page back to last page but the modal is still present. I think there is a way to solve this problem.

Describe Preferred Solution

const modal = await this.modalController.create({
      component: PageComponent
      browserBack:true
    });
await modal.present();
@elylucas
Copy link
Contributor

HI @cdllqos, this seems to be the working behavior in the latest Ionic v4.0.1. Would you mind testing again on the latest and let us know?

Thanks

@cdllqos
Copy link
Author

cdllqos commented Feb 14, 2019

@elylucas nope,I mean that it should close overlay when I click Android 「back button」,I viewed source code,overlay only listened 'esc' events. And I think it should "pushstate" when creating overlay

@joonaspi
Copy link

Bug is still present with 4.2.0. Besides Modals and Toasts I hope the fix would also consider Popovers. They should also disappear when user does press the Browser back button and browser navigates to the previous page.

@liamdebeasi
Copy link
Contributor

Thanks for the feature request. I am going to close this as this is not something we are looking to add at this time.

Please see #16611 (comment) for a full explanation. I have included the relevant part below:

Some developers have requested that users be able to dismiss a modal or close the menu when pressing the hardware back button. While this is possible in a Capacitor/Cordova application via the ionBackButton event, it is not possible when running in a web browser. The only way we can make this work is if we integrate overlay components (ion-modal, ion-popover, etc) and ion-menu with the router. We do not feel that it would be correct to take a temporary component such as ion-modal and link it with the global state of the router. This could lead to many inconsistencies. For example, if a user lands on the url /app/show-signup-modal which presents a sign up modal, what should be shown underneath the modal? Additionally, what should happen when the user decides to cancel out the modal? The modal is very much dependent on the context in which it was presented. This is something we lose by integrating these kinds of components with the router.

@ionitron-bot
Copy link

ionitron-bot bot commented Jun 12, 2020

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 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement
Projects
None yet
Development

No branches or pull requests

5 participants