Skip to content

Commit 97f813c

Browse files
authored
Show a pressed filter chip as a selected item (#209)
A pressed chip on bench's Filters panel now takes the system's selected-item look: the accent-soft wash, ink text, and an accent-ink border, in place of the solid accent fill with white text. A press on it darkens the wash, as the windowed chip's does. Will chose this over the fill on 7 Nov after seeing both in both themes. Signed-off-by: Will Manning <will@willmanning.io>
1 parent 3ca167c commit 97f813c

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

‎src/bench/styles/globals.css‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -900,9 +900,9 @@ main {
900900
}
901901
.filter-chip--active,
902902
.filter-chip--active:hover {
903-
background: var(--accent);
904-
border-color: var(--accent);
905-
color: var(--on-accent);
903+
background: var(--accent-soft);
904+
border-color: var(--accent-ink);
905+
color: var(--ink);
906906
}
907907
.filter-chip--all {
908908
font-weight: 500;
@@ -1773,7 +1773,7 @@ a.site-footer-sha:hover code {
17731773
transform: none;
17741774
}
17751775
.filter-chip--active:active {
1776-
background: color-mix(in srgb, var(--accent) 82%, var(--ground));
1776+
background: color-mix(in srgb, var(--accent-ink) 22%, transparent);
17771777
}
17781778
.chart-window-chip[data-state='windowed']:not(:disabled):active {
17791779
background: color-mix(in srgb, var(--accent-ink) 22%, transparent);

‎src/bench/styles/tokens.test.ts‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,23 @@ describe("bench's stylesheet on the system's tokens", () => {
105105

106106
// Words take accent-ink; fills take accent with on-accent text. In Light the two are one Blue.
107107
it('fills with accent and writes on it in on-accent', () => {
108-
for (const sel of ['.filter-badge', '.filter-chip--active']) {
109-
expect(lastValue(sel, 'background'), sel).toBe('var(--accent)');
110-
expect(lastValue(sel, 'color'), sel).toBe('var(--on-accent)');
111-
}
112-
expect(lastValue('.filter-chip--active:hover', 'border-color')).toBe('var(--accent)');
108+
expect(lastValue('.filter-badge', 'background')).toBe('var(--accent)');
109+
expect(lastValue('.filter-badge', 'color')).toBe('var(--on-accent)');
113110
expect(lastValue('.toolbar-slider', 'accent-color')).toBe('var(--accent)');
114111
expect(lastValue('.chart-range-strip-handle', 'background')).toBe('var(--accent)');
115112
});
116113

117-
// Bench's Blue names Vortex, its line, and a pressed chip. A link is ink at rest and Blue only
114+
// A pressed chip is a selected item, not a fill: the accent-soft wash, ink text, and an
115+
// accent-ink border, as the system's States rule says. Under the pointer it stays the same.
116+
it('draws a pressed chip as a selected item', () => {
117+
for (const sel of ['.filter-chip--active', '.filter-chip--active:hover']) {
118+
expect(lastValue(sel, 'background'), sel).toBe('var(--accent-soft)');
119+
expect(lastValue(sel, 'border-color'), sel).toBe('var(--accent-ink)');
120+
expect(lastValue(sel, 'color'), sel).toBe('var(--ink)');
121+
}
122+
});
123+
124+
// Bench's Blue names Vortex, its line, and a pressed chip's border. A link is ink at rest and Blue only
118125
// under the pointer. Under the pointer an outlined control's border turns ink, and a row takes
119126
// the wash, as the system's States rule says.
120127
it('keeps Blue off links at rest and off hovers', () => {

0 commit comments

Comments
 (0)