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).
This commit is contained in:
2026-10-19 20:10:28 +01:00
parent d1f09f499f
commit 72f00cd871
2 changed files with 11 additions and 6 deletions
+6 -1
View File
@@ -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;
}
}
+5 -5
View File
@@ -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")]