-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(dialog): prevent dialog from opening while another dialog is animating #5769
Conversation
…ating Prevents dialogs from being opened while other dialogs are animating. Fixes angular#5713.
@@ -91,11 +91,19 @@ export class MdDialog { | |||
*/ | |||
open<T>(componentOrTemplateRef: ComponentType<T> | TemplateRef<T>, | |||
config?: MdDialogConfig): MdDialogRef<T> { | |||
|
|||
const inProgressDialog = this._openDialogs.find(dialog => dialog._isAnimating()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's worthwhile to key this on the component as well? E.g., if I try to open(UserProfile)
multiple times in a row, they get blocked, but if I try to open(UserProfile)
and open(AdminSettings)
at the same time then they both open?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see how that would be useful, but it's probably too much trouble. There's only a 400ms window after you open a dialog where this can happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with this for now and see if we get any feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The behavior where we don't allow new dialogs to be opened while a dialog is animating was introduced initially in angular#5769 to avoid issues where the user might open multiple dialogs by accident if they press enter one too many times. This is problematic because it also means that the consumer is blocked from opening dialogs for certain 300ms intervals. These changes approach the issue differently by moving focus onto the dialog container immediately while it's animating. Fixes angular#5769.
The behavior where we don't allow new dialogs to be opened while a dialog is animating was introduced initially in angular#5769 to avoid issues where the user might open multiple dialogs by accident if they press enter one too many times. This is problematic because it also means that the consumer is blocked from opening dialogs for certain 300ms intervals. These changes approach the issue differently by moving focus onto the dialog container immediately while it's animating. Fixes angular#6560.
…8051) The behavior where we don't allow new dialogs to be opened while a dialog is animating was introduced initially in #5769 to avoid issues where the user might open multiple dialogs by accident if they press enter one too many times. This is problematic because it also means that the consumer is blocked from opening dialogs for certain 300ms intervals. These changes approach the issue differently by moving focus onto the dialog container immediately while it's animating. Fixes #6560.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Prevents dialogs from being opened while other dialogs are animating.
Fixes #5713.
Note: I wasn't able to write a test that properly captures the issue that this is solving (I tried using the
BrowserAnimationsModule
instead of the noop module as well). In unit tests, it seems like the callbacks are fired immediately, whereas we have the animations disabled in the e2e tests in general.