-
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
help(Overlay): Animation works only on first attachment , #24749
Labels
area: cdk/overlay
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Comments
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Apr 21, 2022
When an overlay is detached, we remove it from the change detection tree and the DOM, but we don't destroy it completely so that it can be re-attached. Re-attachment is the same process, but in reverse: we re-add the element to the DOM and the change detection tree. The problem is that we were attaching the element to the change detection tree before re-inserting it into the DOM which caused the Angular animations package not to animate the element since it's not in the DOM yet. These changes resolve the issue by attaching the element to the DOM first. Fixes angular#24749.
There are a couple of problems with your example:
There are a couple of ways to work around it:
|
andrewseguin
pushed a commit
that referenced
this issue
Apr 22, 2022
When an overlay is detached, we remove it from the change detection tree and the DOM, but we don't destroy it completely so that it can be re-attached. Re-attachment is the same process, but in reverse: we re-add the element to the DOM and the change detection tree. The problem is that we were attaching the element to the change detection tree before re-inserting it into the DOM which caused the Angular animations package not to animate the element since it's not in the DOM yet. These changes resolve the issue by attaching the element to the DOM first. Fixes #24749.
andrewseguin
pushed a commit
that referenced
this issue
Apr 22, 2022
When an overlay is detached, we remove it from the change detection tree and the DOM, but we don't destroy it completely so that it can be re-attached. Re-attachment is the same process, but in reverse: we re-add the element to the DOM and the change detection tree. The problem is that we were attaching the element to the change detection tree before re-inserting it into the DOM which caused the Angular animations package not to animate the element since it's not in the DOM yet. These changes resolve the issue by attaching the element to the DOM first. Fixes #24749. (cherry picked from commit 0faba6e)
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: cdk/overlay
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
What are you trying to do?
I'm trying to implement a generic auto completion.
My code is structured in following way
dsAutocomplete
directive is top level directivedsAutocompleteInputTrigger
is directive attached to<input>
elementdsAutoCompleteOrigin
is attached to element on whose drop down need to be anchored*dsAutocompletePanel
is a structural directive to define what is dropdownFlow of actions is
For opening
dsAutocompleteInputTrigger.focus
->dsAutocomplete.openPanel
->overlayRef.attach(TemplatePortal(dsAutocompletePanel))
as FlexibleConnected todsAutoCompleteOrigin
For closing
dsAutocompleteInputTrigger.focusout
->dsAutocomplete.closePanel
->overlayRef.detach()
when I add an animation directive any where in AutoComplete Panel it only works first time
What troubleshooting steps have you tried?
Tried adding attach and detach in zone.run
Reproduction
follow instruction in following stackblitz
https://stackblitz.com/edit/angular-ivy-smmzcq?file=src%2Fapp%2Fapp.component.html
Environment
The text was updated successfully, but these errors were encountered: