angular / angular/components

mat-expansion-panel keeps contents of collapsed panels in DOM

Open
#20,680 12 comments 0 reactions 0 assignees View on GitHub
area: material/expansion G P2
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

I found this while debugging rendering performance in my app. I have a large section that initially renders as a big mat-expansion-panel with all panels collapsed, except one. Here is a screenshot of mat-expansion-panel demo that sxhibits the same behavior:

![4kunmyWShAfRwzA](https://user-images.githubusercontent.com/3027415/94566715-f24f3c00-026a-11eb-9c09-139061cd4181.png)

I believe that the contents of the collapsed sections should be removed from the DOM to not slow down the application by rendering content that isn't currently visible.

If the reason for doing that was animations, then the animations probably need fixing - Angular supports keeping things in DOM while they are animating. Or maybe this was used, but the animation end never gets registered? I'm gussing :) In any case I believe it's a bug.

CC @jelbourn

Possilbly related (?): https://github.com/angular/components/issues/8287

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior in the mat-expansion-panel demo shown in the issue, with several panels collapsed and one expanded. Trace the mat-expansion-panel implementation and its animation behavior; done means collapsed panel contents are removed from the DOM without breaking transitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.