Skip to content

Commit e304e6a

Browse files
louismaximepitonmdo
authored andcommitted
Reintroduce #35759 and adding a guard rail on the active state
1 parent 881ed59 commit e304e6a

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

scss/_list-group.scss

+27-25
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,6 @@
4343
}
4444
}
4545

46-
// Interactive list items
47-
//
48-
// Use anchor or button elements instead of `li`s or `div`s to create interactive
49-
// list items. Includes an extra `.active` modifier class for selected items.
50-
51-
.list-group-item-action {
52-
width: 100%; // For `<button>`s (anchors become 100% by default though)
53-
color: var(--#{$prefix}list-group-action-color);
54-
text-align: inherit; // For `<button>`s (anchors inherit)
55-
56-
// Hover state
57-
&:hover,
58-
&:focus {
59-
z-index: 1; // Place hover/focus items above their siblings for proper border styling
60-
color: var(--#{$prefix}list-group-action-hover-color);
61-
text-decoration: none;
62-
background-color: var(--#{$prefix}list-group-action-hover-bg);
63-
}
64-
65-
&:active {
66-
color: var(--#{$prefix}list-group-action-active-color);
67-
background-color: var(--#{$prefix}list-group-action-active-bg);
68-
}
69-
}
70-
7146
// Individual list items
7247
//
7348
// Use on `li`s or `div`s within the `.list-group` parent.
@@ -115,6 +90,33 @@
11590
}
11691
}
11792

93+
// Interactive list items
94+
//
95+
// Use anchor or button elements instead of `li`s or `div`s to create interactive
96+
// list items. Includes an extra `.active` modifier class for selected items.
97+
98+
.list-group-item-action {
99+
width: 100%; // For `<button>`s (anchors become 100% by default though)
100+
color: var(--#{$prefix}list-group-action-color);
101+
text-align: inherit; // For `<button>`s (anchors inherit)
102+
103+
&:not(.active) {
104+
// Hover state
105+
&:hover,
106+
&:focus {
107+
z-index: 1; // Place hover/focus items above their siblings for proper border styling
108+
color: var(--#{$prefix}list-group-action-hover-color);
109+
text-decoration: none;
110+
background-color: var(--#{$prefix}list-group-action-hover-bg);
111+
}
112+
113+
&:active {
114+
color: var(--#{$prefix}list-group-action-active-color);
115+
background-color: var(--#{$prefix}list-group-action-active-bg);
116+
}
117+
}
118+
}
119+
118120
// Horizontal
119121
//
120122
// Change the layout of list group items from vertical (default) to horizontal.

0 commit comments

Comments
 (0)