Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions public/js/compare/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,19 @@ function pageXrayTemplate(d) {
html += '<caption class="sr-only">Page X-ray comparison: ' +
h(config.har1.label) + ' versus ' + h(config.har2.label) + '</caption>';
html += '<thead><tr>';
html += '<th class="tabletext tableXrayMetric" scope="col">Metric ' +
'<button onclick="regenerate(true);" class="submit submit-smaller" ' +
'aria-label="Swap HAR1 and HAR2">Switch</button> ' +
'<button id="diffOnlyToggle" type="button" ' +
'onclick="toggleDiffOnly(this);" ' +
'class="chip-toggle" ' +
'aria-pressed="' + diffOnlyPressed + '">' +
'Only differences</button></th>';
html += '<th class="tabletext tableXrayMetric" scope="col">' +
'<div class="tableXrayMetric-stack">' +
'<span class="tableXrayMetric-label">Metric</span>' +
'<span class="tableXrayMetric-actions">' +
'<button onclick="regenerate(true);" class="submit submit-smaller" ' +
'aria-label="Swap HAR1 and HAR2">Switch</button>' +
'<button id="diffOnlyToggle" type="button" ' +
'onclick="toggleDiffOnly(this);" ' +
'class="chip-toggle" ' +
'aria-pressed="' + diffOnlyPressed + '">' +
'Only differences</button>' +
'</span>' +
'</div></th>';
html += '<th class="tableXrayHarMetric" scope="col">' + h(config.har1.label) +
'<input type="file" id="har1upload" class="inputfile"/>' +
'<label for="har1upload">Upload</label></th>';
Expand Down
6 changes: 5 additions & 1 deletion src/css/buttons.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
align-items: center;
gap: 4px;
padding: 2px 8px;
margin: 0;
/* Small left margin so the button doesn't sit flush against the
preceding label text (e.g. "Metric Switch", "CPU time spent by
category [arrow]"). Doesn't apply inside flex parents thanks to
`gap` taking over there. */
margin: 0 0 0 8px;
font-size: 0.8rem;
font-weight: var(--font-weight-medium);
vertical-align: middle;
Expand Down
8 changes: 8 additions & 0 deletions src/css/elements.css
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ hr {
}

.card-title {
/* Flex container so inline action chips (e.g. "Side by side" on
the Waterfall card) sit at a sensible distance from the title
text and align vertically to the middle — not the baseline of
a smaller chip against a larger h3. */
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 14px;
margin: 0 0 12px 0;
font-size: 1.125rem;
font-weight: var(--font-weight-semibold);
Expand Down
42 changes: 41 additions & 1 deletion src/css/page-xray.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,35 @@
}

.tableXrayMetric { width: 22%; text-align: left; }

/*
* Metric column header — "Metric" label sits on top of a row of
* action chips (Switch + Only differences). Stacking with flex
* keeps the chips aligned consistently with each other and with the
* column's left edge (which is where the row labels below sit),
* instead of relying on inline-wrap and ending up indented.
*/
.tableXrayMetric-stack {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 6px;
}
.tableXrayMetric-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
/* Negative margin so the button's visible text edge lines up with
the metric labels below ("URL", "Date", …) — the button's own
border + padding would otherwise indent the text by ~9px. */
margin-left: -9px;
}
.tableXrayMetric-actions .chip-toggle,
.tableXrayMetric-actions .submit-smaller {
/* `gap` handles spacing — strip the default left margins. */
margin-left: 0;
}
.tableXrayHarMetric,
.tableXrayHar2Metric { width: 31%; }
.tableXrayDiff { width: 16%; text-align: right; padding-right: 12px; color: var(--color-text-muted); font-weight: var(--font-weight-medium); }
Expand Down Expand Up @@ -101,7 +130,11 @@
display: inline-flex;
align-items: center;
padding: 4px 10px;
margin-left: 4px;
/* Visually separate from any preceding button or text. Reset to 0
inside a flex parent (e.g. .card-title) where `gap` already
handles the spacing. */
margin-left: 12px;
vertical-align: middle;
background: var(--color-surface);
color: var(--color-text-secondary);
border: 1px solid var(--color-border);
Expand All @@ -112,6 +145,9 @@
transition: background var(--motion-fast), color var(--motion-fast),
border-color var(--motion-fast);
}
.card-title > .chip-toggle {
margin-left: 0;
}
.chip-toggle:hover,
.chip-toggle:focus-visible {
background: var(--color-blue-tint);
Expand Down Expand Up @@ -213,6 +249,10 @@
display: inline-flex;
align-items: center;
padding: 6px 14px;
/* Keep the chip away from the HAR1 / HAR2 column label text it
sits next to. */
margin-left: 10px;
vertical-align: middle;
background: var(--color-surface);
color: var(--color-text-secondary);
border: 1px solid var(--color-border);
Expand Down
Loading