Skip to content

Commit 8aa65a3

Browse files
Fix missing border & add transitions
1 parent b89fe31 commit 8aa65a3

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

scss/_accordion.scss

+22-25
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
@include font-size($font-size-base);
1212
color: $accordion-button-color;
1313
background-color: $accordion-button-bg;
14-
border: solid $accordion-border-color;
15-
border-width: $accordion-border-width $accordion-border-width 0;
14+
border: $accordion-border-width solid $accordion-border-color;
1615
@include border-radius(0);
1716
overflow-anchor: none;
17+
@include transition($accordion-transition);
18+
19+
&.collapsed {
20+
border-bottom-width: 0;
21+
}
1822

1923
&:not(.collapsed) {
2024
color: $accordion-button-active-color;
@@ -45,8 +49,9 @@
4549

4650
&:focus {
4751
z-index: 3;
52+
border-color: $accordion-button-focus-border-color;
4853
outline: 0;
49-
box-shadow: $btn-focus-box-shadow;
54+
box-shadow: $accordion-button-focus-box-shadow;
5055
}
5156
}
5257

@@ -55,35 +60,35 @@
5560
}
5661

5762
.accordion-item {
58-
@include border-radius($accordion-border-radius);
63+
&:first-of-type {
64+
.accordion-button {
65+
@include border-top-radius($accordion-border-radius);
66+
}
67+
}
5968

6069
&:last-of-type {
6170
.accordion-button {
62-
border-bottom-width: $accordion-border-width;
63-
6471
// Only set a border-radius on the last item if the accordion is collapsed
6572
&.collapsed {
73+
border-bottom-width: $accordion-border-width;
6674
@include border-bottom-radius($accordion-border-radius);
6775
}
6876
}
6977

70-
.accordion-body {
71-
border-width: 0 $accordion-border-width $accordion-border-width;
78+
.accordion-collapse {
79+
border-bottom-width: $accordion-border-width;
7280
@include border-bottom-radius($accordion-border-radius);
7381
}
7482
}
83+
}
7584

76-
&:first-of-type {
77-
.accordion-button {
78-
@include border-top-radius($accordion-border-radius);
79-
}
80-
}
85+
.accordion-collapse {
86+
border: solid $accordion-border-color;
87+
border-width: 0 $accordion-border-width;
8188
}
8289

8390
.accordion-body {
8491
padding: $accordion-body-padding-y $accordion-body-padding-x;
85-
border: solid $accordion-border-color;
86-
border-width: $accordion-border-width $accordion-border-width 0;
8792
}
8893

8994

@@ -98,15 +103,11 @@
98103
@include border-radius(0);
99104
}
100105

101-
.accordion-body {
106+
.accordion-collapse {
102107
border-width: 0;
103108
}
104109

105110
.accordion-item {
106-
border-right-width: 0;
107-
border-left-width: 0;
108-
@include border-radius(0);
109-
110111
&:first-of-type {
111112
.accordion-button {
112113
border-top-width: 0;
@@ -115,14 +116,10 @@
115116
}
116117

117118
&:last-of-type {
118-
.accordion-button {
119+
.accordion-button.collapsed {
119120
border-bottom-width: 0;
120121
@include border-bottom-radius(0);
121122
}
122-
123-
.accordion-body {
124-
border-width: 0;
125-
}
126123
}
127124
}
128125
}

scss/_variables.scss

+4
Original file line numberDiff line numberDiff line change
@@ -1030,9 +1030,13 @@ $accordion-button-padding-y: $accordion-padding-y !default;
10301030
$accordion-button-padding-x: $accordion-padding-x !default;
10311031
$accordion-button-color: $accordion-color !default;
10321032
$accordion-button-bg: $accordion-bg !default;
1033+
$accordion-transition: $btn-transition, border-radius .15s ease !default;
10331034
$accordion-button-active-bg: tint-color($component-active-bg, 90%) !default;
10341035
$accordion-button-active-color: $primary !default;
10351036

1037+
$accordion-button-focus-border-color: $input-focus-border-color !default;
1038+
$accordion-button-focus-box-shadow: $btn-focus-box-shadow !default;
1039+
10361040
$accordion-icon-width: 1.25rem !default;
10371041
$accordion-icon-color: $accordion-color !default;
10381042
$accordion-icon-active-color: $accordion-button-active-color !default;

site/content/docs/5.0/components/accordion.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Click the accordions below to expand/collapse the accordion content.
2929
Accordion Item #1
3030
</button>
3131
</h2>
32-
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
32+
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
3333
<div class="accordion-body">
3434
<strong>This is the first item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
3535
</div>
@@ -41,7 +41,7 @@ Click the accordions below to expand/collapse the accordion content.
4141
Accordion Item #2
4242
</button>
4343
</h2>
44-
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
44+
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
4545
<div class="accordion-body">
4646
<strong>This is the second item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
4747
</div>
@@ -53,7 +53,7 @@ Click the accordions below to expand/collapse the accordion content.
5353
Accordion Item #3
5454
</button>
5555
</h2>
56-
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
56+
<div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
5757
<div class="accordion-body">
5858
<strong>This is the third item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
5959
</div>
@@ -74,7 +74,7 @@ Add `.accordion-flush` to remove the default `background-color`, some borders, a
7474
Accordion Item #1
7575
</button>
7676
</h2>
77-
<div id="flush-collapseOne" class="collapse" aria-labelledby="flush-headingOne" data-parent="#accordionFlushExample">
77+
<div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-parent="#accordionFlushExample">
7878
<div class="accordion-body">Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.</div>
7979
</div>
8080
</div>
@@ -84,7 +84,7 @@ Add `.accordion-flush` to remove the default `background-color`, some borders, a
8484
Accordion Item #2
8585
</button>
8686
</h2>
87-
<div id="flush-collapseTwo" class="collapse" aria-labelledby="flush-headingTwo" data-parent="#accordionFlushExample">
87+
<div id="flush-collapseTwo" class="accordion-collapse collapse" aria-labelledby="flush-headingTwo" data-parent="#accordionFlushExample">
8888
<div class="accordion-body">Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.</div>
8989
</div>
9090
</div>
@@ -94,7 +94,7 @@ Add `.accordion-flush` to remove the default `background-color`, some borders, a
9494
Accordion Item #3
9595
</button>
9696
</h2>
97-
<div id="flush-collapseThree" class="collapse" aria-labelledby="flush-headingThree" data-parent="#accordionFlushExample">
97+
<div id="flush-collapseThree" class="accordion-collapse collapse" aria-labelledby="flush-headingThree" data-parent="#accordionFlushExample">
9898
<div class="accordion-body">Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.</div>
9999
</div>
100100
</div>

0 commit comments

Comments
 (0)