fix(cdk/overlay): animations interrupted on repeat insertions#24815
Merged
andrewseguin merged 1 commit intoApr 22, 2022
Conversation
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.
f048be9 to
a34912b
Compare
andrewseguin
pushed a commit
that referenced
this pull request
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)
crapStone
pushed a commit
to Calciumdibromid/CaBr2
that referenced
this pull request
May 1, 2022
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@angular/cdk](https://github.com/angular/components) | dependencies | patch | [`13.3.4` -> `13.3.5`](https://renovatebot.com/diffs/npm/@angular%2fcdk/13.3.4/13.3.5) | | [@angular/material](https://github.com/angular/components) | dependencies | patch | [`13.3.4` -> `13.3.5`](https://renovatebot.com/diffs/npm/@angular%2fmaterial/13.3.4/13.3.5) | --- ### Release Notes <details> <summary>angular/components</summary> ### [`v13.3.5`](https://github.com/angular/components/blob/HEAD/CHANGELOG.md#​1335-bread-bun-2022-04-27) [Compare Source](angular/components@13.3.4...13.3.5) ##### cdk | Commit | Type | Description | | -- | -- | -- | | [68d09ddecd](angular/components@68d09dd) | fix | **overlay:** animations interrupted on repeat insertions ([#​24815](angular/components#24815)) | ##### material | Commit | Type | Description | | -- | -- | -- | | [86a1e8c7be](angular/components@86a1e8c) | fix | **autocomplete:** outside click in Angular zone. ([#​24817](angular/components#24817)) | ##### material-experimental | Commit | Type | Description | | -- | -- | -- | | [b16a33dbb2](angular/components@b16a33d) | fix | **mdc-slider:** remove pointerdown passive eve… ([#​24766](angular/components#24766)) | | [6603bd5ec6](angular/components@6603bd5) | fix | **mdc-snack-bar:** avoid querying the DOM on each change detection ([#​24770](angular/components#24770)) | #### Special Thanks Egor Volvachev, Jesse Beder, Kirill Cherkashin, Kristiyan Kostadinov, Paul Gschwendtner, Ruslan Lekhman, Sukka and Wagner Maciel <!-- CHANGELOG SPLIT MARKER --> </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1330 Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
This was referenced May 10, 2022
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Note: writing a unit test for this is tricky, because the content is never actually destroyed so we can't use lifecycle hooks for assertions.