Public: anyone can read this; the crew can change it.
j/k, enter, esc and ? on settings/devices, with test/keys-<page>.test.ts #10808
Check · Review · Land · Live done — Landed and live in production.
This adds `test/keys-devices.test.ts` and changes nothing in `src/`, because `/settings/devices` already had the keys on its section list. The new test passes, `bun scripts/gate.ts` and `bun x tsc --noEmit` are clean, and I ran no other tests.
shipped production is serving it deploy 951be3d
This adds test/keys-devices.test.ts and changes nothing in src/, because /settings/devices already had the keys on its section list. The new test passes, bun scripts/gate.ts and bun x tsc --noEmit are clean, and I ran no other tests.
What the page already had. The settings sidebar, drawn by settingsLayout, makes every settings section a data-nav row. On /settings/devices, j/k already walk those sections and Enter already opens one. ? and the field guard come from the shared shell, so no new JS was needed. Only the test was missing.
What the test drives. It renders the real page as an admin with a declared printer, then runs the shell script over the markup in happy-dom:
- Focus:
jsteps away from the current section (Devices) andksteps back. - Enter: it clicks the focused section's link and records where it came from.
- Field guard:
jandEnterdo nothing inside an input. - Esc: the page itself carries
data-navrows, so Esc has nowhere to return to and does nothing. I asserted that rather than a return. ?: it is handled and prevented.
What I left out. I did not make the printer cards rows. A card holds only forms (Remove, Grant, Set limit, Revoke) and has no page to open. A data-nav row there would take j/k focus and then do nothing on Enter. The test asserts the cards carry no data-nav, so this choice is pinned.
To try it: bun test test/keys-devices.test.ts.
🤖 Generated with Claude Code
Test-only pull; /settings/devices already had j/k/Enter/Esc/? through the settings sidebar rows, and the test pins that honestly (including that Esc does nothing on a page that is itself a list, and that printer cards are not rows). No src, README or dependency change; the preview answers (303 to sign-in without a session, as expected). Two things I would do next: (1) in the first test, assert indexOf("class=\"list setting-list\"") >= 0 before slicing, so a markup rename cannot make the not-a-row check pass vacuously (slice(-1) would); (2) pair the Esc case with one where nav-from names a different list, to pin that Esc does return there from this page.
This adds
test/keys-devices.test.tsand changes nothing insrc/, because/settings/devicesalready had the keys on its section list. The new test passes,bun scripts/gate.tsandbun x tsc --noEmitare clean, and I ran no other tests.What the page already had. The settings sidebar, drawn by
settingsLayout, makes every settings section adata-navrow. On/settings/devices,j/kalready walk those sections andEnteralready opens one.?and the field guard come from the shared shell, so no new JS was needed. Only the test was missing.What the test drives. It renders the real page as an admin with a declared printer, then runs the shell script over the markup in happy-dom:
jsteps away from the current section (Devices) andksteps back.jandEnterdo nothing inside an input.data-navrows, so Esc has nowhere to return to and does nothing. I asserted that rather than a return.?: it is handled and prevented.What I left out. I did not make the printer cards rows. A card holds only forms (Remove, Grant, Set limit, Revoke) and has no page to open. A
data-navrow there would takej/kfocus and then do nothing onEnter. The test asserts the cards carry nodata-nav, so this choice is pinned.To try it:
bun test test/keys-devices.test.ts.🤖 Generated with Claude Code
Closes #10797