-
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
bug(expansion-panel): [style*=...]
attribute selector causes whole-page slowdown in Chromium
#27946
Comments
I don't have an easy way to test this, but I suspect this can be fixed by changing this animation to additionally change a CSS custom variable (e.g. components/src/material/expansion/expansion-animations.ts Lines 57 to 62 in 52c85e5
and then changing this CSS rule to apply that variable to all children: components/src/material/expansion/expansion-panel.scss Lines 78 to 80 in 52c85e5
& * {
visibility: var(--mat-expansion-panel-content-force-visibility) !important;
} |
We should be able to fix this by setting a class on the component when it's opened/closed. |
Reworks the expansion panel to animate purely with CSS, rather than going through the `@angular/animations` module. This simplifies the setup and allows us to resolve several long-standing bug reports. Fixes angular#27946. Fixes angular#22715. Fixes angular#21434. Fixes angular#20610. Fixes angular#20517. Fixes angular#17177. Fixes angular#16534. Fixes angular#16503. Fixes angular#14952. Fixes angular#14759. Fixes angular#14075. Fixes angular#11765.
Reworks the expansion panel to animate purely with CSS, rather than going through the `@angular/animations` module. This simplifies the setup and allows us to resolve several long-standing bug reports. Fixes angular#27946. Fixes angular#22715. Fixes angular#21434. Fixes angular#20517. Fixes angular#17177. Fixes angular#16534. Fixes angular#16503. Fixes angular#14952. Fixes angular#14759. Fixes angular#14075. Fixes angular#11765.
Reworks the expansion panel to animate purely with CSS, rather than going through the `@angular/animations` module. This simplifies the setup and allows us to resolve several long-standing bug reports. Fixes #27946. Fixes #22715. Fixes #21434. Fixes #20517. Fixes #17177. Fixes #16534. Fixes #16503. Fixes #14952. Fixes #14759. Fixes #14075. Fixes #11765. (cherry picked from commit aafa151)
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. |
Is this a regression?
The previous version in which this bug was not present was
before #24045 (probably, I haven't tested it)
Description
Strictly speaking, this is a Chromium bug, but (AFAICT) the only workaround is to change the CSS in the expansion panel component.
Currently, in Chromium-based browsers, the presence of a CSS rule selector like
.blah[style*="something"] *
means that any change to thestyle
attribute of any element, anywhere on the page will force a style recalculation of that element's entire subtree. There is currently a rule like this inexpanion-panel
:components/src/material/expansion/expansion-panel.scss
Line 78 in 52c85e5
Additionally, since
expanion-panel
hasViewEncapsulation.None
, Angular won't limit the rule's scope using[_nghost]
/[_ngcontent]
attribute selectors, and Angular will copy the rule into anyShadowDom
-encapsulated components.components/src/material/expansion/expansion-panel.ts
Line 82 in 52c85e5
This issue was first noted in this comment.
Reproduction
StackBlitz link: https://stackblitz.com/edit/components-issue-bsuofa?file=src%2Fapp%2Fexample-component.ts
Steps to reproduce:
Proof that
expansion-panel
is responsible:<mat-expansion-panel>
element (and its children) fromexample-component.html
.Proof that the
[style]
selector is responsible:<div class="mat-expansion-panel-body">
is selected..mat-expansion-panel-content[style*="visibility: hidden"] *
to remove[style*=...]
Expected Behavior
The animation is smooth regardless of if an expansion panel exists or what the expansion panel component does internally.
Actual Behavior
The animation is smooth only after modifying an expansion-panel-internal CSS rule.
Environment
The text was updated successfully, but these errors were encountered: