Skip to content

Commit

Permalink
Use child combinators to avoid inheriting parent accordion's styles (#…
Browse files Browse the repository at this point in the history
…37508)

Co-authored-by: Patrick H. Lauke <redux@splintered.co.uk>
Co-authored-by: Julien Déramond <juderamond@gmail.com>
  • Loading branch information
3 people authored Nov 17, 2023
1 parent 55952bf commit ee88ae6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scss/_accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
&:first-of-type {
@include border-top-radius(var(--#{$prefix}accordion-border-radius));

.accordion-button {
> .accordion-header .accordion-button {
@include border-top-radius(var(--#{$prefix}accordion-inner-border-radius));
}
}
Expand All @@ -105,13 +105,13 @@
&:last-of-type {
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));

.accordion-button {
> .accordion-header .accordion-button {
&.collapsed {
@include border-bottom-radius(var(--#{$prefix}accordion-inner-border-radius));
}
}

.accordion-collapse {
> .accordion-collapse {
@include border-bottom-radius(var(--#{$prefix}accordion-border-radius));
}
}
Expand All @@ -127,24 +127,26 @@
// Remove borders and border-radius to keep accordion items edge-to-edge.

.accordion-flush {
.accordion-collapse {
border-width: 0;
}

.accordion-item {
> .accordion-item {
border-right: 0;
border-left: 0;
@include border-radius(0);

&:first-child { border-top: 0; }
&:last-child { border-bottom: 0; }

.accordion-button {
// stylelint-disable selector-max-class
> .accordion-header .accordion-button {
&,
&.collapsed {
@include border-radius(0);
}
}
// stylelint-enable selector-max-class

> .accordion-collapse {
@include border-radius(0);
}
}
}

Expand Down

0 comments on commit ee88ae6

Please sign in to comment.