Skip to content

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

Closed

Description

@Abrissirba

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.

Activity

  1. added
    feature
    P5
    on Mar 16, 2017
  2. SylvainSimon commented on Apr 26, 2017

    @SylvainSimon

    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!

  3. michastreppel commented on Apr 26, 2017

    @michastreppel
    Contributor

    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 }

  4. reppners commented on Sep 6, 2017

    @reppners

    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.

  5. skybluerunner commented on Mar 26, 2018

    @skybluerunner

    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.

  6. simeyla commented on Jun 12, 2018

    @simeyla

    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.

  7. playnox commented on Jun 19, 2018

    @playnox

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

  8. nicktobolski commented on Jul 17, 2018

    @nicktobolski

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

  9. jpduckwo commented on Jul 18, 2018

    @jpduckwo

    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?

  10. added 2 commits that reference this issue on Oct 6, 2018
    a8e5e31
    1dead0f
  11. added a commit that references this issue on Nov 17, 2018
    b933fc1
  12. 5 remaining items

  13. added a commit that references this issue on Feb 25, 2020
    c678d2d
  14. added 4 commits that reference this issue on Nov 9, 2021
    7b8856a
    30c221e
    209fff9
    28465be
  15. added 3 commits that reference this issue on Mar 12, 2022
    36aeca8
    0b31649
    a6cea11
  16. added a commit that references this issue on Mar 14, 2022
    8ef3125
  17. added a commit that references this issue on Apr 3, 2022
    868bb3d
  18. angular-automatic-lock-bot commented on Apr 14, 2022

    @angular-automatic-lock-bot

    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.

  19. locked and limited conversation to collaborators on Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P5area: material/dialogfeature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions