Skip to content

Commit e974660

Browse files
author
Alexis Córdova
authored
fix(button): Add Link Button-specifc Hover/Focus Styles (#4953)
1 parent 4d1156e commit e974660

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

ui/components/buttons/base/_index.scss

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
&:focus {
4848
--slds-c-button-color-border: var(--slds-c-button-color-border-hover);
4949
--slds-c-button-color-background: var(--slds-c-button-color-background-hover);
50-
--slds-c-button-text-color: var(--slds-c-button-text-color-hover, var(--sds-c-button-text-color-hover, #{$brand-accessible-active}));
50+
color: var(--slds-c-button-text-color-hover, var(--sds-c-button-text-color-hover, #{$brand-accessible-active}));
5151
}
5252

5353
&:focus {
@@ -113,10 +113,48 @@ a.slds-button {
113113
}
114114
}
115115

116+
// NOTE: You may notice that these link-specific Button styles are *not* using CSS Custom Property reassignment. This is due to the fact that the global `a:hover` text styles are leaking into the component (which is expected, as `property: value;` declarations override reassignment by design). This shouldn't be necessary in the vast majority of components, but due to the global inheritance at play here this is our best option.
117+
a.slds-button_brand:hover,
118+
a.slds-button--brand:hover,
119+
a.slds-button_brand:focus,
120+
a.slds-button--brand:focus {
121+
color:
122+
var(--slds-c-button-brand-text-color-hover,
123+
var(--sds-c-button-brand-text-color-hover,
124+
var(--slds-g-link-text-color-hover, $color-text-brand-primary)));
125+
}
126+
127+
a.slds-button_destructive:hover,
128+
a.slds-button--destructive:hover,
129+
a.slds-button_destructive:focus,
130+
a.slds-button--destructive:focus {
131+
color:
132+
var(--slds-c-button-destructive-text-color,
133+
var(--sds-c-button-destructive-text-color, $color-text-inverse));
134+
}
135+
136+
a.slds-button_text-destructive:hover,
137+
a.slds-button_text-destructive:focus {
138+
color:
139+
var(--slds-c-button-text-destructive-text-color-hover,
140+
var(--sds-c-button-text-destructive-text-color-hover, $color-text-destructive-hover));
141+
}
142+
143+
a.slds-button_success:hover,
144+
a.slds-button--success:hover,
145+
a.slds-button_success:focus,
146+
a.slds-button--success:focus {
147+
color:
148+
var(--slds-c-button-success-text-color-hover,
149+
var(--sds-c-button-success-text-color-hover, $color-text-inverse));
150+
}
151+
152+
// end NOTE
153+
116154
a.slds-button_inverse:focus,
117155
a.slds-button--inverse:focus {
118156
/*! @css-var-fallback border-color */
119-
--slds-c-button-color-border: var(--sds-c-button-inverse-color-border-focus, var(--sds-c-button-inverse-color-border-focus, #{$color-border-button-focus-inverse}));
157+
--slds-c-button-color-border: var(--slds-c-button-inverse-color-border-focus, var(--sds-c-button-inverse-color-border-focus, #{$color-border-button-focus-inverse}));
120158

121159
/*! @css-var-fallback box-shadow */
122160
--slds-c-button-shadow: var(--slds-c-button-inverse-shadow-focus, var(--sds-c-button-inverse-shadow-focus, #{$shadow-button-focus-inverse}));

0 commit comments

Comments
 (0)