mat-expansion-panel - styles get messed up if panel is a child of another element
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
#### Bug, feature request, or proposal:
The styles of panels will get messed up in the panels are placed in another element (ex: `div`)
Please see pseudo-code example below:
```html
...
...
```
#### What is the expected behavior?
Panels should be styled correctly
#### What is the current behavior?

#### What is the use-case or motivation for changing an existing behavior?
I was trying to implement draggable panels and my implementation has panels inside divs.
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Material 7.0.0-beta.2
#### Is there anything else we should know?
To fix replace [lines 15-29 in expansion-panel.scss](https://github.com/angular/material2/blob/master/src/lib/expansion/expansion-panel.scss#L15-L29):
```scss
.mat-accordion & {
&:not(.mat-expanded), &:not(.mat-expansion-panel-spacing) {
border-radius: 0;
}
&:first-of-type {
border-top-right-radius: $border-radius;
border-top-left-radius: $border-radius;
}
&:last-of-type {
border-bottom-right-radius: $border-radius;
border-bottom-left-radius: $border-radius;
}
}
```
... with the following:
```scss
.mat-accordion & {
&:not(.mat-expanded), &:not(.mat-expansion-panel-spacing) {
border-radius: 0;
}
}
.mat-accordion > &:first-child,
.mat-accordion > &:first-child:not(.mat-expansion-panel) & {
border-top-right-radius: $border-radius;
border-top-left-radius: $border-radius;
}
.mat-accordion > &:last-child,
.mat-accordion > *:last-child:not(.mat-expansion-panel) & {
border-bottom-right-radius: $border-radius;
border-bottom-left-radius: $border-radius;
}
```
Beitragsleitfaden
Rechercherichtung
Beginne in src/lib/expansion/expansion-panel.scss bei den referenzierten Zeilen 15-29 und bilde das verschachtelte mat-expansion-panel-Markup mit div-Wrappern nach. Vergleiche die gemeldete Ersetzung des Selektors mit den vorhandenen Styles und überprüfe anschließend, dass das erste und das letzte Panel korrekte Randradien beibehalten, wenn Panels in andere Elemente verschachtelt sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 48/100