Skip to content

[Bug] OverlayRef on detach will strip panel class before an animation completes #13189

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
byronmejia opened this issue Sep 19, 2018 · 2 comments · Fixed by #13199
Closed

[Bug] OverlayRef on detach will strip panel class before an animation completes #13189

byronmejia opened this issue Sep 19, 2018 · 2 comments · Fixed by #13199
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@byronmejia
Copy link

byronmejia commented Sep 19, 2018

Bug

Panel Class is stripped before animation completes if panel class is animated on detach(). After running a git bisect, I found this was introduced in commit 79bacf2.

https://github.com/angular/material2/blob/19ce1a164e5f861d7744d2f55e1e1b0d29ba32b5/src/cdk/overlay/overlay-ref.ts#L177-L179

This was previously working perfectly in previous versions of @angular/cdk

See /pull/12142

What is the expected behavior?

The class should only be removed after the animation has completed, observer:
expected

What is the current behavior?

The class now gets stripped immediately on detach, even if the component is still running through an animation. Observe:

actual

What are the steps to reproduce?

Will supply a StackBlitz soon, but this is only noticable when an animation exists on the component sitting in the ComponentPortal.

An extract from our code:

@Component({
    selector: 'sc-context-menu',
    templateUrl: './context-menu.component.html',
    styleUrls: ['./context-menu.component.scss'],
    animations: [
        trigger('fadeInOut', [
            state('*', style({ opacity: 1, transform: 'translate3d(0, 0, 0)' })),
            transition(
                ':enter',
                [style({ opacity: 0, transform: '{{ transform }}' }), animate(100)],
                { params: { transform: 'translate3d(0, 0, 0)' } }
            ),
            transition(
                ':leave',
                [animate(100, style({ opacity: 0, transform: '{{ transform }}' }))],
                { params: { transform: 'translate3d(0, 0, 0)' } }
            )
        ])
    ]
})
@byronmejia byronmejia changed the title [Bug] [Bug] OverlayRef on detach will strip panel class before an animation completes Sep 19, 2018
@crisbeto crisbeto self-assigned this Sep 19, 2018
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Sep 19, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 19, 2018
Currently we remove the `panelClass` as soon as `detach` is called, however the pane may still be animating. These changes wait for the panel to be done animating and to be removed from the DOM, before removing the class.

Fixes angular#13189.
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 19, 2018
Currently we remove the `panelClass` as soon as `detach` is called, however the pane may still be animating. These changes wait for the panel to be done animating and to be removed from the DOM, before removing the class.

Fixes angular#13189.
mmalerba pushed a commit that referenced this issue Sep 20, 2018
Currently we remove the `panelClass` as soon as `detach` is called, however the pane may still be animating. These changes wait for the panel to be done animating and to be removed from the DOM, before removing the class.

Fixes #13189.
vivian-hu-zz pushed a commit that referenced this issue Oct 2, 2018
…3199)

Currently we remove the `panelClass` as soon as `detach` is called, however the pane may still be animating. These changes wait for the panel to be done animating and to be removed from the DOM, before removing the class.

Fixes #13189.
@byronmejia
Copy link
Author

Thanks team! Appreciate the support! 😎

roboshoes pushed a commit to roboshoes/material2 that referenced this issue Oct 23, 2018
…gular#13199)

Currently we remove the `panelClass` as soon as `detach` is called, however the pane may still be animating. These changes wait for the panel to be done animating and to be removed from the DOM, before removing the class.

Fixes angular#13189.
@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants