Skip to content

Commit be7a1e1

Browse files
committed
fix(actionbutton): disable css transitions in high contrast
In Windows High Contrast, the border color briefly was flashing orange (ButtonBorder) after hover, before it switched back to the correct color as defined by the styles. This fixes that issue. This removes CSS transitions in high contrast to avoid some of these rendering issues and previously noticed sluggishness in the system color transitions.
1 parent 2d6e5ab commit be7a1e1

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

components/actionbutton/index.css

+20-14
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,14 @@ a.spectrum-ActionButton {
322322

323323
/* Focus indicator */
324324
.spectrum-ActionButton {
325-
transition: border-color var(--mod-actionbutton-animation-duration, var(--spectrum-actionbutton-animation-duration)) ease-in-out;
325+
transition: border-color var(--highcontrast-actionbutton-animation-duration, var(--mod-actionbutton-animation-duration, var(--spectrum-actionbutton-animation-duration))) ease-in-out;
326326

327327
&::after {
328328
position: absolute;
329329
inset: 0;
330330
margin: calc((var(--mod-actionbutton-focus-indicator-gap, var(--spectrum-actionbutton-focus-indicator-gap)) + var(--spectrum-actionbutton-border-width)) * -1);
331331
border-radius: var(--mod-actionbutton-focus-indicator-border-radius, var(--spectrum-actionbutton-focus-indicator-border-radius));
332-
transition: box-shadow var(--mod-actionbutton-animation-duration, var(--spectrum-actionbutton-animation-duration)) ease-in-out;
332+
transition: box-shadow var(--highcontrast-actionbutton-animation-duration, var(--mod-actionbutton-animation-duration, var(--spectrum-actionbutton-animation-duration))) ease-in-out;
333333
pointer-events: none;
334334
content: "";
335335
}
@@ -346,18 +346,6 @@ a.spectrum-ActionButton {
346346

347347
@media (forced-colors: active) {
348348
.spectrum-ActionButton {
349-
&::after {
350-
/* Make sure the box-shadow for the focus indicator renders. */
351-
forced-color-adjust: none;
352-
}
353-
354-
.spectrum-ActionButton-icon,
355-
.spectrum-ActionButton-hold,
356-
.spectrum-ActionButton-label {
357-
/* Removes the extra unwanted background on label ("readability backplate") that can cause text to be unreadable. */
358-
forced-color-adjust: none;
359-
}
360-
361349
/**
362350
* Default
363351
* - Uses "Button*" system color pairings.
@@ -372,6 +360,24 @@ a.spectrum-ActionButton {
372360

373361
--highcontrast-actionbutton-focus-indicator-color: CanvasText;
374362

363+
/**
364+
* Avoid performance and rendering issues with transitions between system colors.
365+
* Fixes bug in Windows High Contrast where border flashes the wrong color after hover (quiet).
366+
*/
367+
--highcontrast-actionbutton-animation-duration: 0;
368+
369+
&::after {
370+
/* Make sure the box-shadow for the focus indicator renders. */
371+
forced-color-adjust: none;
372+
}
373+
374+
.spectrum-ActionButton-icon,
375+
.spectrum-ActionButton-hold,
376+
.spectrum-ActionButton-label {
377+
/* Removes the extra unwanted background on label ("readability backplate") that can cause text to be unreadable. */
378+
forced-color-adjust: none;
379+
}
380+
375381
/**
376382
* Quiet
377383
* - Default blends in with background and has no border.

0 commit comments

Comments
 (0)