From 72f00cd8713ebdb702451572eb8cb99a0be7e4ca Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 20:10:28 +0100 Subject: [PATCH] web: restore focus to a row's real control The a11y work made the chat row a container with its control inside, so Back focused a non-focusable div and keyboard focus fell to the body. Focus the first focusable descendant instead (generic for chat, runs, pipelines and templates). --- web/src/app.js | 7 ++++++- web/test/ui-smoke.mjs | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/web/src/app.js b/web/src/app.js index e0e4de4b..ba3c7452 100644 --- a/web/src/app.js +++ b/web/src/app.js @@ -842,7 +842,12 @@ function restoreListFocus(restore) { ) : null; if (row) { - row.focus(); + // A row may be a plain container whose real control is a child button (the + // a11y work moved the chat session's control inside the row), so focus the + // first focusable descendant rather than a non-focusable div. + const target = + row.matches("button, a, [tabindex]") ? row : row.querySelector("button, a, [tabindex]") ?? row; + target.focus(); return; } } diff --git a/web/test/ui-smoke.mjs b/web/test/ui-smoke.mjs index 109db302..66887415 100644 --- a/web/test/ui-smoke.mjs +++ b/web/test/ui-smoke.mjs @@ -500,7 +500,7 @@ async function runShellChecks() { if (!stillNoPageScroll) throw new Error("opening a chat conversation introduced a page-level scrollbar"); await page.evaluate(`document.querySelector(".pane-back button")?.click()`); await settle(200); - const restoredChatRow = await page.evaluate(`document.activeElement?.getAttribute("data-session") ?? ""`); + const restoredChatRow = await page.evaluate(`document.activeElement?.closest("[data-session]")?.getAttribute("data-session") ?? ""`); if (restoredChatRow !== openedChatId) { throw new Error(`Back from the chat detail restored focus to ${restoredChatRow || "no row"}, not session ${openedChatId}`); } @@ -3292,7 +3292,7 @@ try { // implementer visit changed only retry_test.go and must not show the run-wide // aggregate (or the first visit's docs/runner rows). step("opening run 438's second implementer visit: its own File changes"); - await page.clickText(".detail .detail-tabs .detail-tab", "Timeline"); + await page.clickText(".rail-tab, .strip-tab", "Timeline"); await page.waitForSelector(".detail .timeline-row", { timeout: 15000 }); await page.click('.detail .timeline-row[data-stage-key="implementer"][data-visit-index="1"]'); await page.waitForSelector(".stage-pane", { timeout: 15000 }); @@ -3410,7 +3410,7 @@ try { shots.push(await page.screenshot(`${out}/79-run-440-no-summary-changes.png`)); step("run 440's visit pane keeps that visit's own File changes"); - await page.clickText(".detail .detail-tabs .detail-tab", "Timeline"); + await page.clickText(".rail-tab, .strip-tab", "Timeline"); await page.waitForSelector(".detail .timeline-row", { timeout: 15000 }); await page.click(".detail .timeline-row"); await page.waitForSelector(".stage-pane", { timeout: 15000 }); @@ -3451,7 +3451,7 @@ try { // its own Changed files even though the Summary aggregate is suppressed. step("run 442's failed implementer visit keeps its Changed files"); await openRunDetail(442); - await page.clickText(".detail .detail-tabs .detail-tab", "Timeline"); + await page.clickText(".rail-tab, .strip-tab", "Timeline"); await page.waitForSelector(".detail .timeline-row", { timeout: 15000 }); await page.click('.detail .timeline-row[data-stage-key="implementer"][data-visit-index="0"]'); await page.waitForSelector(".stage-pane", { timeout: 15000 }); @@ -3481,7 +3481,7 @@ try { // A running run has no settled final state either: invert the old pending- // header probe and assert the aggregate is absent while it executes. step("a running run's Summary has no Changes section"); - await page.clickText("nav.tabs button.tab", "Runs"); + await page.click('[data-destination="runs"]'); await page.waitForSelector(".list.runs .run-row", { timeout: 25000 }); const runningRunId = await page.evaluate(`(() => { const row = [...document.querySelectorAll(".list.runs .run-row")]