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.
This commit is contained in:
Zakk committed 2026-09-26 23:50:23 +10:00
1 parent b501bc67c1
commit c00a6e8586
4 files changed
+21 -19

No files matched your search

+8 -7
View File
@@ -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);
}
});
+4 -4
View File
@@ -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() {
<div className="rp-capabilities">
{vm.resources.rows.map(row => (
<div key={row.id} className={'rp-capability' + (row.tone === 'muted' ? ' unavailable' : '')}>
<span>{row.label}</span>
<Light small tone={row.tone}>
{row.text}
</Light>
{/* The dot leads its label, so a wide column cannot set it nearer the next label than its own. */}
<Light tone={row.tone}>{row.label}</Light>
{row.dotOnly ? <VisuallyHidden>{row.text}</VisuallyHidden> : <span className="rp-capability-status">{row.text}</span>}
</div>
))}
</div>
+4 -1
View File
@@ -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'))
+5 -7
View File
@@ -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 {