The off-state thumb reused the palette's primary foreground, which resolves to near-black in dark mode; against the translucent track it read as disabled, while a disabled control differs only by half opacity. Give the off state its own thumb color through the new `--dsw-alias-switch-thumb` alias: white in light mode and neutral-bluish 400 in dark mode. The plugin management info button also becomes an 11px caption-colored icon in a 20px square, keeping the 4px gap beside the subtitle. Refs #5347
50 lines
1.1 KiB
CSS
50 lines
1.1 KiB
CSS
/* The on/off appearance keys off aria-checked rather than a parallel class, so
|
|
* the visual state cannot disagree with the state assistive technology reads.
|
|
*
|
|
* The capsule track and circular thumb opt out of the global superellipse. */
|
|
.switch {
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
flex: 0 0 auto;
|
|
width: 36px;
|
|
height: 20px;
|
|
padding: 2px;
|
|
border: 0;
|
|
border-radius: 999px;
|
|
corner-shape: round;
|
|
background: var(--dsw-alias-border-l3);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.switch[aria-checked='true'] {
|
|
background: var(--dsw-alias-brand-primary);
|
|
}
|
|
|
|
.switch:disabled {
|
|
cursor: default;
|
|
opacity: 0.5;
|
|
}
|
|
|
|
.switch:focus-visible {
|
|
outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
.thumb {
|
|
display: block;
|
|
width: 16px;
|
|
height: 16px;
|
|
border-radius: 50%;
|
|
corner-shape: round;
|
|
background: var(--dsw-alias-label-primary-foreground);
|
|
transition: transform 120ms ease;
|
|
}
|
|
|
|
.switch[aria-checked='false'] .thumb {
|
|
background: var(--dsw-alias-switch-thumb);
|
|
}
|
|
|
|
.switch[aria-checked='true'] .thumb {
|
|
transform: translateX(16px);
|
|
}
|