Skip to content
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

Use child combinators to avoid inheriting parent accordion's flush styles #37508

Merged
merged 10 commits into from
Nov 17, 2023
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