From c00a6e85864b5123759dcf84398c423eaa1adaec Mon Sep 17 00:00:00 2001 From: Zakk Date: Sat, 26 Sep 2026 23:04:48 +1000 Subject: [PATCH] fix(overview): show available backend features as a dot only In English most labels on the Backend features card were cut short, because "Available" beside each one took half of a 136px column. Each feature now leads with its status dot, so a wide column cannot set the dot nearer the next label than its own; available features show the dot alone, with the status still given to screen readers, and unavailable ones spell it out on the right. Columns start at 148px, which fits every label in en, zh-CN and zh-TW from 320px to 2560px and keeps two columns where the card is narrowest. --- e2e/overview.spec.ts | 15 ++++++++------- src/features/overview/Overview.tsx | 8 ++++---- src/features/overview/view.ts | 5 ++++- src/ui/styles/indicators-charts.css | 12 +++++------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/e2e/overview.spec.ts b/e2e/overview.spec.ts index 55baf650..0389d069 100644 --- a/e2e/overview.spec.ts +++ b/e2e/overview.spec.ts @@ -134,22 +134,23 @@ test('an accepted source reload respects Retry-After and retains the draft on te expect(write.headers()['if-match']).toBe(`"${source.content_sha256}"`); }); -test('backend features share columns with inline statuses', async ({page}) => { +test('backend features lead with a dot, keep whole labels and share columns', async ({page}) => { await page.setViewportSize({width: 1440, height: 900}); await page.goto('/#/overview'); const card = page.getByRole('region', {name: 'Backend features', exact: true}); await expect(card.getByText('Connections', {exact: true})).toBeVisible(); - const rows = await card.locator('.rp-capabilities > div').evaluateAll(elements => + const rows = await card.locator('.rp-capability').evaluateAll(elements => elements.map(element => { - const [label, status] = [...element.children].map(child => child.getBoundingClientRect()); - return {label: {left: label.left, top: label.top}, status: {left: status.left, top: status.top}}; + const label = element.querySelector('.rp-light > span')!; + return {left: Math.round(element.getBoundingClientRect().left), cut: label.scrollWidth > label.clientWidth, text: element.textContent}; }) ); expect(rows.length).toBeGreaterThan(10); - expect(new Set(rows.map(row => Math.round(row.label.left))).size).toBeGreaterThanOrEqual(2); + expect(new Set(rows.map(row => row.left)).size).toBeGreaterThanOrEqual(2); for (const row of rows) { - expect(Math.abs(row.status.top - row.label.top)).toBeLessThan(8); - expect(row.status.left).toBeGreaterThan(row.label.left); + expect(row.cut).toBe(false); + // The status stays in the text even where only the dot shows it. + expect(row.text).toMatch(/available/i); } }); diff --git a/src/features/overview/Overview.tsx b/src/features/overview/Overview.tsx index ce9486cd..1c7a6c2e 100644 --- a/src/features/overview/Overview.tsx +++ b/src/features/overview/Overview.tsx @@ -1,3 +1,4 @@ +import {VisuallyHidden} from 'react-aria'; import {useOverview} from './useOverview'; import {useT} from '../../i18n'; import {ActionGroup, Badge, Card, Bar, DataTable, Kv, Light, TextTooltip, ErrorMessage, Loading, Empty} from '../../ui/ui'; @@ -141,10 +142,9 @@ export function Overview() {
{vm.resources.rows.map(row => (
- {row.label} - - {row.text} - + {/* The dot leads its label, so a wide column cannot set it nearer the next label than its own. */} + {row.label} + {row.dotOnly ? {row.text} : {row.text}}
))}
diff --git a/src/features/overview/view.ts b/src/features/overview/view.ts index efdde54b..0538f1d7 100644 --- a/src/features/overview/view.ts +++ b/src/features/overview/view.ts @@ -209,7 +209,10 @@ export function overviewView( id, label: t(resourceLabels[id]), tone: available ? ('ok' as const) : ('muted' as const), - text: t(available ? 'ov.available' : 'ov.notAvailable') + text: t(available ? 'ov.available' : 'ov.notAvailable'), + // Most rows are available, so their status is the dot alone and only the exceptions are spelled out; + // the text still reaches assistive technology. + dotOnly: available }; }) .sort((a, b) => Number(a.tone === 'muted') - Number(b.tone === 'muted')) diff --git a/src/ui/styles/indicators-charts.css b/src/ui/styles/indicators-charts.css index 52042224..a5a386e1 100644 --- a/src/ui/styles/indicators-charts.css +++ b/src/ui/styles/indicators-charts.css @@ -123,7 +123,8 @@ } .rp-capabilities { display: grid; - grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr)); + /* Fits the longest English label after its dot, and two columns in the card's narrowest desktop width. */ + grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); gap: 4px 12px; flex: 1 1 auto; align-content: space-between; @@ -136,21 +137,18 @@ min-width: 0; min-height: 40px; } -.rp-capability > span:first-child { - min-width: 0; +.rp-capability .rp-light > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.rp-capability .rp-light { +.rp-capability-status { flex: none; white-space: nowrap; + font-size: var(--rp-text-xs); } .rp-capability.unavailable { color: var(--rp-negative-text); -} -.rp-capability.unavailable .rp-light { - color: var(--rp-negative-text); --dot: var(--rp-negative); } .rp-legend {