Skip to content

Commit 3f012df

Browse files
committed
Website: improve visibility of benchmark row selection
When hovering (selecting) a linter in the benchmark results, the border around the table row feels weird and unintuitive to me. Instead of adding a border for selection, deemphasize unselected rows by lowering their contrast with the background.
1 parent 8c63fa5 commit 3f012df

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

website/public/benchmarks/benchmark.css

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -319,33 +319,17 @@ body.javascript .javascript-only {
319319
}
320320
}
321321

322-
/* Create a border around each row which is visible if a row is selected. (Only
323-
one row can be selected at a time.) */
324-
.benchmark-table tbody tr td,
325-
.benchmark-table tbody tr th {
326-
border: 2px solid transparent;
327-
}
328-
.benchmark-table tbody tr:not(:last-child) td,
329-
.benchmark-table tbody tr:not(:last-child) th {
330-
border-bottom-width: 0;
331-
}
332-
.benchmark-table tbody tr td:not(:first-child),
333-
.benchmark-table tbody tr th:not(:first-child) {
334-
border-left-width: 0;
335-
}
336-
.benchmark-table tbody tr td:not(:last-child),
337-
.benchmark-table tbody tr th:not(:last-child) {
338-
border-right-width: 0;
339-
}
340-
.benchmark-table tbody tr.selected td,
341-
.benchmark-table tbody tr.selected th {
342-
border-bottom-width: 2px;
343-
border-color: hsla(var(--hue), 70%, 50%);
322+
/* Deemphasize unselected rows. */
323+
.benchmark-table.have-selection tbody tr:not(.selected) td,
324+
.benchmark-table.have-selection tbody tr:not(.selected) th {
325+
background-color: hsla(var(--hue), 70%, 90%);
326+
color: rgba(0, 0, 0, 0.4);
344327
}
345328
@media (prefers-color-scheme: dark) {
346-
.benchmark-table tbody tr.selected td,
347-
.benchmark-table tbody tr.selected th {
348-
border-color: hsla(var(--hue), 70%, 40%);
329+
.benchmark-table.have-selection tbody tr:not(.selected) td,
330+
.benchmark-table.have-selection tbody tr:not(.selected) th {
331+
background-color: hsla(var(--hue), 70%, 10%);
332+
color: rgba(255, 255, 255, 0.4);
349333
}
350334
}
351335

website/public/benchmarks/benchmark.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ class Benchmark {
188188
getSeries(seriesElement) === seriesToSelect
189189
);
190190
}
191+
this.tableElement.classList.toggle(
192+
"have-selection",
193+
seriesToSelect !== null
194+
);
191195
for (let rowElement of this.tableElement.querySelectorAll("tbody tr")) {
192196
rowElement.classList.toggle(
193197
"selected",

0 commit comments

Comments
 (0)