Skip to content

Commit 8a8ede9

Browse files
committed
fix: button elevation issue
1 parent 0a81bca commit 8a8ede9

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

scss/_button-group.scss

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,36 @@
44
.btn-group,
55
.btn-group-vertical {
66
position: relative;
7-
z-index: 1;
87
display: inline-flex;
98
vertical-align: middle; // match .btn alignment given font-size hack above
109

1110
> .btn {
1211
position: relative;
1312
flex: 1 1 auto;
13+
&:not([class*="ghost"]):not([class*="link"]):not([class*="outline"]):not([class*="transparent"]) {
14+
@include elevation(0);
15+
@include elevation(1, false, true);
16+
}
1417

1518
// Bring the hover, focused, and "active" buttons to the front to overlay
1619
// the borders properly
1720
@include hover() {
18-
z-index: 2;
21+
z-index: 1;
1922
}
2023
&:focus,
2124
&:active,
2225
&.active {
23-
z-index: 2;
26+
z-index: 1;
2427
}
2528
}
26-
27-
.btn-group,
28-
.btn-group-vertical {
29-
z-index: auto;
29+
@if $enable-elevations {
30+
&:not(.show) {
31+
z-index: 1;
32+
}
33+
.btn-group,
34+
.btn-group-vertical {
35+
z-index: initial;
36+
}
3037
}
3138
}
3239

@@ -129,15 +136,13 @@
129136

130137
// The clickable button for toggling the menu
131138
// Set the same inset shadow as the :active state
132-
.btn-group.show {
133-
z-index: 3;
134-
.dropdown-toggle {
135-
@include box-shadow($btn-active-box-shadow);
136139

137-
// Show no shadow for `.btn-link` since it has no other button styles.
138-
&.btn-link {
139-
@include box-shadow(none);
140-
}
140+
.btn-group.show .dropdown-toggle {
141+
@include box-shadow($btn-active-box-shadow);
142+
143+
// Show no shadow for `.btn-link` since it has no other button styles.
144+
&.btn-link {
145+
@include box-shadow(none);
141146
}
142147
}
143148

scss/_buttons.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-line-height, $btn-border-radius);
2020
@include transition($btn-transition);
2121
&:not([class*="ghost"]):not([class*="link"]):not([class*="outline"]):not([class*="transparent"]) {
22-
@include elevation(1, false, true);
22+
@include elevation(1);
2323
}
2424

2525
@include hover() {

scss/mixins/_elevation.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
}
99

1010
@mixin add-elevation-before($level, $direction) {
11-
position: relative;
1211
border: 0;
1312
&::before {
1413
position: absolute;

0 commit comments

Comments
 (0)