Skip to content

Add possibility to turn off animation of dialog enter/exit #3616

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

Closed
Abrissirba opened this issue Mar 15, 2017 · 9 comments · Fixed by #13466
Closed

Add possibility to turn off animation of dialog enter/exit #3616

Abrissirba opened this issue Mar 15, 2017 · 9 comments · Fixed by #13466
Assignees
Labels
area: material/dialog feature This issue represents a new feature or feature request rather than a bug or bug fix P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@Abrissirba
Copy link

Abrissirba commented Mar 15, 2017

Is/will it be possible to turn off the animation added in #2825? The animation is not very smooth when the dialog contains something that needs much performance, especially in IE.

It would also be good if you could subscribe to when the animation has finished.

@jelbourn jelbourn added feature This issue represents a new feature or feature request rather than a bug or bug fix P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Mar 16, 2017
@SylvainSimon
Copy link

SylvainSimon commented Apr 26, 2017

I have a problem that requires the same option.

I need to quickly unhook my closing event when I close my window. But it is blocking because the event is triggered after the animation, which easily takes 1 second.

If my user closes and re-opens the window quickly (because the overlay goes away from the beginning of the animation leaving the possibility of clicking on the button of opening of window), then it makes to disfunction the router!

So the animation is very nice but it poses functional problems in some cases!

@michastreppel
Copy link
Contributor

michastreppel commented Apr 26, 2017

One way of disabling this animation is the following (based on a post on StackOverflow: http://stackoverflow.com/questions/43055988/turn-off-animation-at-runtime-in-angular )

In your (main) module add the following function:

export function animationFactory(): any {
    const noop = AnimationDriver.NOOP;
    const driver = new ɵWebAnimationsDriver();
    return {
        animate: (element: any, keyframes: {
            [key: string]: string | number;
        }[], duration: number, delay: number, easing: string, previousPlayers?: any[]) => {
            if (element.tagName === 'MD-DIALOG-CONTAINER') {
                return noop.animate(element, keyframes, duration, delay, easing, previousPlayers);
            } else {
                return driver.animate(element, keyframes, duration, delay, easing, previousPlayers);
            }
        }
    };
};

Then specify in the providers section of your module
{ provide: AnimationDriver, useFactory: animationFactory }

@reppners
Copy link

reppners commented Sep 6, 2017

Got the same problem with the animation performance even when using Chrome on a macbook - as soon as there is a component contained in the dialog that does more than just a piece of text and two buttons the animation is not smooth at all. So I'd rather have no animation than a poor performing one or at least a hook to do heavy init after animation has finished.

@thinkingmedia
Copy link

I'm looking at the code and it looks like MatDialogContainer is coded so that the function reference is used directly in the MatDialog. This means, that we can not inject a replacement class that the MatDialog service could use.

So I was thinking if a new component was added to the template of MatDialogContainer that it was changed from <ng-template cdkPortalOutlet></ng-template> to maybe this <mat-dialog-animation><ng-template cdkPortalOutlet></ng-template></mat-dialog-animation>.

This would defer the animation to another component, and also use the injector to create that component. We could then override that component by providing a different wrapper with our own animations.

@simeyla
Copy link

simeyla commented Jun 12, 2018

If this is considered could we please get easy ability to change the direction.
I don't care if it's 'against the spec'. The default just doesn't work in all situations.

@playnox
Copy link

playnox commented Jun 19, 2018

Same issue here, Dialog and Datepicker preforms very poorly... Please give us the ability to get rid of animations.

@nicktobolski
Copy link

I'm also experiencing very poor performance on all but the best devices for dialogs when nesting components within.

@jpduckwo
Copy link

I'm also experiencing problems with this. I was wondering if there is a way to detect when the open animation completes in the dialog component then show a placeholder until the open animation completes, then switch to the full component detail... any ideas?

@crisbeto crisbeto added the has pr label Oct 6, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 6, 2018
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 6, 2018
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 17, 2018
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jun 10, 2019
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 22, 2019
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 22, 2019
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 25, 2019
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 25, 2019
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 25, 2020
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 9, 2021
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 9, 2021
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 9, 2021
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 10, 2021
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 12, 2022
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 12, 2022
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 12, 2022
Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
crisbeto added a commit that referenced this issue Mar 14, 2022
…ion (#13466)

Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes #3616.
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
…ion (angular#13466)

Since the dialog animation is on the `MatDialogContainer`, consumers aren't able to disable the animation. These changes add properties to the dialog config that allow consumers to set the duration of the dialog's enter and exit animations.

Fixes angular#3616.
@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 Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/dialog feature This issue represents a new feature or feature request rather than a bug or bug fix P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.