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;
}
}