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

Routing sample Dialog broken on web plaform, Back button does not close #2018

Open
nolandg opened this issue Sep 6, 2021 · 0 comments
Open
Labels

Comments

@nolandg
Copy link

nolandg commented Sep 6, 2021

The Routing and Navigation sample has a dialog accessible from the Settings screen. The Cancel/OK buttons use Navigator.pop() to close the dialog and that works

onPressed: () => Navigator.pop(context, 'Cancel'),

But when the dialog is open and the web browser's back button is pressed, the dialog stays open and the page behind it navigates back. This is wrong.

I'm confident that this is would be highly unexpected UX for any real app--the back button should have the same effect as poping to maintain a consistent UX.

This is a serious problem my team has been unable to solve. We've tried all of the following and none of them seem to trigger for the browser's back button:

  • WillPopScope
  • BackButtonListener
  • backButtonDispatcher.didPopRoute()
  • window.onBeforeUnload

If we can't listen for the back button and warn the user about unsaved data loss and block the navigation, this is a serious limitation of the platform. How are people solving this? Thanks!

@domesticmouse domesticmouse transferred this issue from flutter/samples Sep 18, 2023
@domesticmouse domesticmouse transferred this issue from flutter/flutter Sep 18, 2023
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

3 participants