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

MdDialog does not close when browser's back or forward button clicked #2601

Closed
JDillon522 opened this issue Jan 11, 2017 · 4 comments · Fixed by #2742
Closed

MdDialog does not close when browser's back or forward button clicked #2601

JDillon522 opened this issue Jan 11, 2017 · 4 comments · Fixed by #2742
Assignees
Labels
P2 The issue is important to a large percentage of users, with a workaround

Comments

@JDillon522
Copy link

Bug, feature request, or proposal:

Bug (maybe?)

What is the expected behavior?

When an MdDialog is open and the user clicks the back button the dialog should automatically close.

What is the current behavior?

The dialog stays open.

What are the steps to reproduce?

You can reproduce by launching the documentation example and then clicking back. The dialog stays open. At a minimum, I think it would be a good property set on the MdDialogRef

What is the use-case or motivation for changing an existing behavior?

I can see a use case for keeping it open if you wanted to force user interaction, but I think in general its not a good idea to override UI changes triggered by a browsers back or forward button.

Which versions of Angular, Material, OS, browsers are affected?

angular-cli: 1.0.0-beta.24
node: 6.9.3
os: darwin x64
@angular/common: 2.4.2
@angular/compiler: 2.4.2
@angular/core: 2.4.2
@angular/forms: 2.4.2
@angular/http: 2.4.2
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.2
@angular/platform-browser-dynamic: 2.4.2
@angular/router: 3.4.2
@angular/compiler-cli: 2.4.2
@jelbourn jelbourn added the P2 The issue is important to a large percentage of users, with a workaround label Jan 12, 2017
@jelbourn
Copy link
Member

This may be tricky to resolve since we don't want to introduce a dependency on @angular/router in material. It may ultimately end up being something we just have to provide guidance for in the documentation.

@crisbeto
Copy link
Member

I think that we could try listening for the pop state event. Will have to check how it plays with stuff like guards.

@jelbourn
Copy link
Member

@vicb mentioned he might have an idea on how to do this.

crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 21, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 31, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 7, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 21, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 16, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 23, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
crisbeto added a commit to crisbeto/material2 that referenced this issue Apr 24, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
crisbeto added a commit to crisbeto/material2 that referenced this issue Apr 24, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
crisbeto added a commit to crisbeto/material2 that referenced this issue Apr 25, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes angular#2601.
mmalerba pushed a commit that referenced this issue Apr 25, 2017
Closes all of the open dialogs when the user goes forwards/backwards in history.

Fixes #2601.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants