fix(app): restyle the timeline detail slider and visibility buttons (#64186)

This commit is contained in:
Aarav Sareen
2026-11-16 14:20:57 +05:30
committed by GitHub
Unverified
parent 0354362b85
commit f4107529f6
3 changed files with 67 additions and 64 deletions
@@ -159,7 +159,7 @@ for (const direction of ["ltr", "rtl"]) {
story(`fits narrow and wide layouts in ${direction}, ${theme}`, async ({ mount, page }, testInfo) => {
await page.setViewportSize({ width: 900, height: 900 })
const component = await mount("settings-timeline-detail--interactive", { globals: { direction, theme } })
await expect(component.locator('[data-slot="timeline-detail-scale"]')).toHaveCSS("margin-top", "16px")
await expect(component.locator('[data-slot="timeline-detail-scale"]')).toHaveCSS("margin-top", "4px")
const advanced = component.locator('[data-slot="timeline-detail-advanced"]')
await expect(advanced).toHaveCSS("margin-top", "0px")
await expect(advanced).toHaveCSS("padding-top", "8px")
@@ -176,23 +176,23 @@ for (const direction of ["ltr", "rtl"]) {
await track.evaluate(
(element, theme) =>
getComputedStyle(element)
.getPropertyValue(theme === "light" ? "--v2-background-bg-layer-04" : "--v2-background-bg-layer-03")
.getPropertyValue(theme === "light" ? "--v2-background-bg-layer-04" : "--v2-background-bg-layer-02")
.trim(),
theme,
),
)
if (theme === "light") {
await expect(track.locator("span").last()).toHaveCSS("background-image", "none")
await expect(track).toHaveCSS(
"--timeline-detail-marker-background",
await track.evaluate((element) => getComputedStyle(element).getPropertyValue("--v2-grey-500").trim()),
)
}
if (theme === "dark") {
await expect(track.locator("span").last()).not.toHaveCSS("background-image", "none")
}
await expect(track.locator("span").last()).toHaveCSS("background-image", "none")
await expect(track).toHaveCSS(
"--timeline-detail-marker-background",
await track.evaluate(
(element, theme) =>
getComputedStyle(element)
.getPropertyValue(theme === "light" ? "--v2-grey-500" : "--v2-grey-700")
.trim(),
theme,
),
)
await page.screenshot({ path: testInfo.outputPath(`timeline-${theme}-${direction}.png`) })
const list = component.locator('[data-slot="timeline-detail-list"]')
@@ -243,7 +243,7 @@ for (const direction of ["ltr", "rtl"]) {
expect(Math.abs(heading - toggle)).toBeLessThan(1)
}
await expect(component.locator('[data-slot="timeline-detail-activity"]').first()).toHaveCSS("gap", "8px")
await expect(component.locator('[data-slot="timeline-detail-activity"]').first()).toHaveCSS("gap", "12px")
for (const width of [900, 320]) {
await page.setViewportSize({ width, height: 900 })
+46 -46
View File
@@ -1,6 +1,18 @@
[data-component="timeline-detail-control"] {
--timeline-detail-track-background: var(--v2-background-bg-layer-04);
--timeline-detail-marker-background: var(--v2-grey-500);
/* The midpoint of the checked radio's gradient. */
--timeline-detail-accent:
linear-gradient(var(--v2-alpha-light-10), var(--v2-alpha-light-10)), var(--v2-background-bg-accent);
--timeline-detail-thumb:
radial-gradient(
circle,
var(--v2-grey-300) 3.5px,
var(--v2-overlay-gradient-depth-overlay-depth-top) 4px,
transparent 4px
),
radial-gradient(circle at 50% calc(50% + 0.5px), rgb(0 0 0 / 0.4) 4px, transparent 4.5px),
linear-gradient(180deg, var(--v2-alpha-light-20) 0%, var(--v2-alpha-light-0) 100%), var(--v2-background-bg-accent);
position: relative;
display: flex;
min-width: 0;
@@ -24,16 +36,16 @@
[data-slot="timeline-detail-scale"] {
position: relative;
height: 28px;
margin-top: 16px;
margin-top: 4px;
margin-inline: 8px;
}
[data-slot="timeline-detail-track"] {
position: absolute;
inset-inline: 0;
top: 12px;
height: 4px;
border-radius: 2px;
top: 13px;
height: 2px;
border-radius: 1px;
background: var(--timeline-detail-track-background);
pointer-events: none;
@@ -44,22 +56,20 @@
width: var(--timeline-detail-progress);
height: 100%;
border-radius: inherit;
background: var(--v2-background-bg-accent);
background: var(--timeline-detail-accent);
}
span {
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
box-sizing: content-box;
width: 6px;
height: 6px;
border: 2px solid var(--v2-background-bg-layer-01);
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--timeline-detail-marker-background);
&[data-selected] {
background: var(--v2-background-bg-accent);
background: var(--timeline-detail-accent);
}
&:dir(rtl) {
@@ -68,6 +78,16 @@
}
}
[data-slot="timeline-detail-scale"][data-custom] {
input[type="range"]::-webkit-slider-thumb {
opacity: 0;
}
input[type="range"]::-moz-range-thumb {
opacity: 0;
}
}
input[type="range"] {
appearance: none;
position: relative;
@@ -86,29 +106,24 @@
}
&::-webkit-slider-runnable-track {
height: 4px;
height: 2px;
background: transparent;
}
&::-webkit-slider-thumb {
appearance: none;
box-sizing: border-box;
width: 16px;
height: 16px;
margin-top: -6px;
margin-top: -7px;
border: 0;
border-radius: 50%;
background:
linear-gradient(
180deg,
var(--v2-overlay-gradient-depth-overlay-depth-top) 0%,
var(--v2-overlay-gradient-depth-overlay-depth-bot) 100%
),
var(--v2-grey-300);
box-shadow: var(--v2-elevation-button-neutral);
background: var(--timeline-detail-thumb);
box-shadow: inset 0 0 0 0.5px var(--v2-border-border-strong);
}
&::-moz-range-track {
height: 4px;
height: 2px;
background: transparent;
}
@@ -118,14 +133,8 @@
height: 16px;
border: 0;
border-radius: 50%;
background:
linear-gradient(
180deg,
var(--v2-overlay-gradient-depth-overlay-depth-top) 0%,
var(--v2-overlay-gradient-depth-overlay-depth-bot) 100%
),
var(--v2-grey-300);
box-shadow: var(--v2-elevation-button-neutral);
background: var(--timeline-detail-thumb);
box-shadow: inset 0 0 0 0.5px var(--v2-border-border-strong);
}
}
@@ -147,9 +156,6 @@
[data-slot="collapsible-arrow"] {
width: 16px;
}
&:focus-visible [data-slot="collapsible-arrow"] {
opacity: 1;
}
@@ -213,7 +219,7 @@
[data-slot="timeline-detail-category"] {
min-height: 40px;
padding-block: 8px;
padding-inline: 12px;
padding-inline: 9.5px 12px;
border-bottom: 0.5px solid var(--v2-border-border-base);
&:last-child {
@@ -236,7 +242,7 @@
[data-slot="timeline-detail-activity"] {
display: flex;
align-items: center;
gap: 8px;
gap: 12px;
min-width: 0;
> label {
@@ -249,13 +255,13 @@
flex-shrink: 0;
}
[data-action="timeline-detail-visibility"][aria-pressed="true"] {
color: var(--v2-icon-icon-base);
[data-action="timeline-detail-visibility"][aria-pressed="false"] {
color: var(--v2-icon-icon-muted);
}
/* Labels also activate :hover on their associated button. Keep that feedback local to the icon. */
&:has(> label:hover) [data-action="timeline-detail-visibility"][data-variant="ghost-muted"] {
background-color: transparent;
&:has(> label:hover) [data-action="timeline-detail-visibility"][data-variant="neutral"] {
background-image: none;
}
}
}
@@ -279,14 +285,8 @@
}
[data-color-scheme="dark"] [data-component="timeline-detail-control"] {
--timeline-detail-track-background: var(--v2-background-bg-layer-03);
--timeline-detail-marker-background:
linear-gradient(
180deg,
var(--v2-overlay-gradient-depth-overlay-depth-top) 0%,
var(--v2-overlay-gradient-depth-overlay-depth-bot) 100%
),
var(--v2-grey-300);
--timeline-detail-track-background: var(--v2-background-bg-layer-02);
--timeline-detail-marker-background: var(--v2-grey-700);
}
@container timeline-detail (max-width: 250px) {
@@ -50,16 +50,16 @@ export function TimelineDetailControl(props: { value: TimelineDetail; onChange:
{language.t("settings.timeline.description")}
</div>
</div>
<div data-slot="timeline-detail-scale">
<div data-slot="timeline-detail-scale" data-custom={preset() ? undefined : ""}>
<div
data-slot="timeline-detail-track"
aria-hidden="true"
style={{ "--timeline-detail-progress": `${(position() / (presets.length - 1)) * 100}%` }}
style={{ "--timeline-detail-progress": `${preset() ? (position() / (presets.length - 1)) * 100 : 0}%` }}
>
<For each={presets}>
{(_, index) => (
<span
data-selected={index() <= position() ? "" : undefined}
data-selected={preset() && index() <= position() ? "" : undefined}
style={{ "inset-inline-start": `${(index() / (presets.length - 1)) * 100}%` }}
/>
)}
@@ -76,6 +76,10 @@ export function TimelineDetailControl(props: { value: TimelineDetail; onChange:
aria-valuetext={label()}
aria-describedby={`${id}-description ${id}-preset-description`}
onInput={(event) => props.onChange({ ...presets[event.currentTarget.valueAsNumber].value })}
// A click on the current value fires no input event.
onClick={(event) => {
if (!preset()) props.onChange({ ...presets[event.currentTarget.valueAsNumber].value })
}}
/>
</div>
<p id={`${id}-preset-description`} aria-live="polite">
@@ -119,7 +123,6 @@ export function TimelineDetailControl(props: { value: TimelineDetail; onChange:
<IconButton
id={`${id}-${category}-visibility`}
type="button"
variant="ghost-muted"
size="small"
data-action="timeline-detail-visibility"
aria-label={language.t("settings.timeline.visibility.label", {