Repository navigation
Description
P3 · WCAG 2.1 SC 2.4.3 (Focus Order) · Reproduced locally at e3943c5f5c1e69c39309bb8f5b9cf5e63ce41672 in Chromium, keyboard only.
When a keyboard user confirms a destructive row action, the row, or the button that opened the dialog, leaves the page, and focus drops to <body>. This happened on every list tried:
- Settings: Teams, API keys (REST), Members, WebDAV and AI providers.
- Contacts: its row menu is already wired the way bug(platform): credential and member row-menu dialogs drop keyboard focus to the page body #3715 asks, and focus still drops.
On Teams, API keys, Members and AI providers, the next Tab starts again at Skip to main content. Governance → Competences shows a pattern that keeps focus on the page.
Reproduction
- Settings → Teams with two teams. Tab to a row's Open menu, press Enter, arrow to Delete, press Enter.
- Tab to Delete in the confirmation and press Enter.
- Read
document.activeElement, then press Tab.
The same happens with:
- API keys: row menu → Revoke key.
- Members: row menu → Delete, then the Remove member confirmation.
- WebDAV: the row's Revoke button. The row stays, marked revoked, without its button.
- AI providers: row menu → Delete.
- Contacts: row menu → Delete.
Rows tried:
- A row with others left: every list above.
- The only row, so the list becomes empty: Teams and API keys.
Expected: focus stays in the list: on the next row's control, on a stable and labelled list region, or on the create action when the list became empty. The design-system accessibility guide asks to "Test Escape, explicit cancellation, completion, and a failed request". For an opener that unmounts, it asks to "supply a stable restoreFocusRef" (accessibility.md:50).
Actual: <body> in every case. The next Tab from there:
- Skip to main content on Teams, API keys, Members and AI providers;
- the "Revoked" toast on WebDAV;
- the next row's checkbox on Contacts. Even there, nothing had focus after the confirmation.
User impact
After each deletion, no control has focus. On four of the six lists, the next Tab restarts at the top of the document. Working through a list of stale keys, teams or credentials then means re-navigating the rail and the toolbar after each one.
Cause
useRestoreFocus(use-restore-focus.ts:66–91) treats a menu item as a transient opener, which goes away with its menu. It then falls back torestoreFocusRef. When that fallback is disconnected too, it leaves focus to Radix's default, which is<body>.- A confirmed delete removes the fallback as well.
contact-row-actions.tsxwires the row's menu trigger (L82–106), and the delete removes that trigger with the row. team-row-actions.tsx(L67–83) andapi-key-row-actions.tsx(L39–46) wire no fallback at all. That is the gap bug(platform): credential and member row-menu dialogs drop keyboard focus to the page body #3715 describes for the credential and member row menus; the Escape case on these two lists is added to bug(platform): credential and member row-menu dialogs drop keyboard focus to the page body #3715 in a comment.- On WebDAV, the row's actions render nothing once it is revoked (webdav-settings.tsx:221), and its
DeleteDialoggets norestoreFocusRef(L255–264). - Competences passes
restoreFocusRef={tableRegionRef}, a focusable wrapperdiv(tabIndex={-1},aria-label= the page title) around its table (competences-page.tsx:361–366, L425). A completed revoke therefore keeps focus on the page. A shared fix should give such a target a role that allows a name, such asrole="region"with its label: ARIA does not allow naming a plaindiv.
Relation to #3715
#3715 is the Escape/cancel path of row-menu dialogs that wire no trigger. This issue is the completion path. Contacts is wired and still drops focus once its row is gone, so wiring triggerRef alone (the #3715 fix) does not cover it. Please keep both as separate regressions.
Suggested acceptance test
A Chromium test for the shared EntityRowActions + DataTable path and for the WebDAV list:
- By keyboard, confirm the delete of (a) a row with others left and (b) the only row.
- Assert that
document.activeElementis not<body>and sits in the list: the next row's control, the labelled list region, or the empty state's create action. - Press Tab and assert that focus stays in the main content.
Keep the Escape case (#3715) as its own assertion.
Evidence: frozen output (proof-f1-delete-focus.cjs, one fresh organization)
setup: fresh org fCUMfIGB1Z0PhA6N02CwYdRZozmyQNEQ
CONTROL Teams create "Alpha team" -> focus button "Create team"
CONTROL Teams create "Beta team" -> focus button "Create team"
CONFIRMED Teams: delete a team (one row remains; rows now 1): focus -> BODY | next Tab -> a "Skip to main content"
CONFIRMED Teams: delete the LAST team (empty state shown: true): focus -> BODY | next Tab -> a "Skip to main content"
CONTROL API keys create "key one" -> Done -> focus button "Create API key"
CONTROL API keys create "key two" -> Done -> focus button "Create API key"
CONFIRMED API keys: revoke a key (one row remains): focus -> BODY | next Tab -> a "Skip to main content"
CONFIRMED API keys: revoke the LAST key (Create API key buttons now 1): focus -> BODY | next Tab -> a "Skip to main content"
CONFIRMED Members: remove a member: focus -> BODY | next Tab -> a "Skip to main content"
CONTROL WebDAV revoke > Escape -> focus button "Revoke"
CONFIRMED WebDAV: revoke an app-password (row stays as "revoked", its Revoke button goes): focus -> BODY | next Tab -> li "Revoked"
CONFIRMED AI providers: delete a credential (one row remains): focus -> BODY | next Tab -> a "Skip to main content"
CONTROL Contacts row menu > Delete > Escape -> focus button "Open menu"
CONFIRMED Contacts (restoreFocusRef wired): delete a contact (one row remains): focus -> BODY | next Tab -> button[role=checkbox] "Select row"
competence fixture -> 201 | row control = Revoke contract-review from Owner f1focus
CONTROL Competences: revoke a grant (the row leaves the Active list) -> focus div "Competences"
--- console/http log --- (none)
Controls in the same run:
- Escape returns focus to the opener on Contacts and WebDAV.
- Creating a team, and closing the API-key success dialog, return focus to the create button.
- Revoking a competence keeps focus on the "Competences" wrapper.
Mocked boundary: none. Real SPA build, backend and PostgreSQL; keyboard only.
Deduplication
Searched the titles and bodies of all 1,072 issues, in every state, for focus after a delete, revoke, remove or confirmation:
- Bug: Dialogs and the command palette do not return focus to their trigger on close (focus falls to <body>) — WCAG 2.4.3 #1988 and Bug: logout confirmation dialog does not return focus to its trigger on close #2681 (both closed) fixed the Escape/cancel return.
- bug(platform): credential and member row-menu dialogs drop keyboard focus to the page body #3715 covers cancelling from unwired row menus; bug(platform): credential and member row-menu dialogs drop keyboard focus to the page body #3725 is a closed copy of it.
- Bug: task dialog leaves keyboard focus on the background board #3557 and Bug: top-level task list rows cannot be opened from the keyboard #3559 concern the task dialog and task rows.
No issue covers the completion path. Found by the TALE-70 local audit. No production system, real provider, mailbox or external delivery was used.
Local stack (loopback only)
- Source: a detached worktree of
e3943c5f5c1e69c39309bb8f5b9cf5e63ce41672(origin/main on 2026-09-28) withbun install --frozen-lockfile. The code named in this issue is unchanged on maine71775a8b(9 commits later). - Databases: PostgreSQL 16.14 (embedded-postgres binaries) with pgvector 0.8.6 on
127.0.0.1;tale_app, andtale_knowledgewithvector. No pg_search (not involved). - Backend, from
services/platform:node --experimental-transform-types --import ./backend/node-loader.mjs backend/main.tswithROLE=all PORT=3005 SITE_URL=http://localhost:3000 NODE_ENV=development, an emptyTALE_CONFIG_DIR,TALE_CONFIG_BUILTIN_DIR=configs/platform/custom,TALE_ALLOW_OPEN_SIGN_UP=true,TALE_DEV_SEED_USER=1, locally generatedBETTER_AUTH_SECRET/ENCRYPTION_SECRET_HEX/INSTANCE_SECRET, and no object store. Egress is blocked:NODE_USE_ENV_PROXY=1 HTTP_PROXY=HTTPS_PROXY=http://127.0.0.1:9 NO_PROXY=127.0.0.1,localhost,::1. - SPA:
bun --bun vite build, thenTALE_BACKEND_URL=http://127.0.0.1:3005 bunx --bun vite preview --port 3000(the production-build E2E serving path; the boot-shell prerender step was skipped). - Browser: Chromium 141.0.7390.37 headless, driven by the worktree's
playwright-core1.58.2 withserviceWorkers: 'block',en-US, 1280×900. - Fixtures: each proof signs up its own accounts and organization through
POST /api/auth/sign-up/emailandPOST /api/auth/organization/create. Credentials carry fake secrets that nothing tests; no provider, mailbox or other external service is reachable. - Replay:
T70_ROOT=<dir> node <proof>.cjs, where<dir>/taleis the worktree and<dir>/evidence/receives the log; adjust the Chromium path inlib.cjs.
probes/proof-f1-delete-focus.cjs
// PROOF F1: confirming a row's delete / revoke / remove drops keyboard focus to <body>, and the next Tab restarts
// at "Skip to main content" — also on Contacts, whose row menu IS wired to restoreFocusRef (#3715's control).
// Controls in the same run: Escape on Contacts' and WebDAV's dialogs returns focus to the opener; creating the
// first team and closing the API-key success dialog return focus to the create button; revoking a grant on
// Governance > Competences (whose dialog restores focus to a stable table region) keeps focus on the page.
// Mocked boundary: none (real SPA build, backend, Postgres). Keyboard only for every flow under test.
// Fixtures: one fresh synthetic org; fake secrets that nothing ever tests.
const L = require('./lib.cjs');
const out = [];
const say = (...a) => { const s = a.map((x) => (typeof x === 'string' ? x : JSON.stringify(x))).join(' '); out.push(s); console.log(s); };
async function openRowMenu(page, row, item) {
const trigger = row.getByRole('button', { name: /open menu|actions for/i }).first();
await trigger.focus();
await page.keyboard.press('Enter');
await L.focusMenuItem(page, item);
await page.keyboard.press('Enter');
}
async function confirm(page, re) {
const dlg = page.getByRole('dialog');
await dlg.waitFor();
await L.tabTo(page, re);
await page.keyboard.press('Enter');
await dlg.waitFor({ state: 'detached', timeout: 10000 }).catch(() => say(' (dialog still open)'));
await L.sleep(1200);
}
async function after(page, tag) {
const f = await L.focusedDesc(page);
await page.keyboard.press('Tab');
const next = await L.focusedDesc(page);
say(`${f === 'BODY' ? 'CONFIRMED' : 'ok'} ${tag}: focus -> ${f} | next Tab -> ${next}`);
}
(async () => {
const browser = await L.launch();
const log = [];
try {
const o = await L.freshOrg(browser, 'f1focus');
say('setup: fresh org', o.orgId);
const page = await o.ctx.newPage();
L.watch(page, log);
const dlg = page.getByRole('dialog');
// Teams: first create (control), then delete the non-last and the last team
await L.goto(page, `/dashboard/${o.orgId}/settings/teams`);
for (const n of ['Alpha team', 'Beta team']) {
await page.getByRole('button', { name: 'Create team' }).focus();
await page.keyboard.press('Enter');
await dlg.waitFor();
await page.keyboard.type(n);
await page.keyboard.press('Enter');
await dlg.waitFor({ state: 'detached', timeout: 10000 }).catch(() => {});
await L.sleep(800);
say(`CONTROL Teams create "${n}" -> focus ${await L.focusedDesc(page)}`);
}
await openRowMenu(page, page.locator('tbody tr').first(), /Delete/);
await confirm(page, /^button "Delete/);
await after(page, `Teams: delete a team (one row remains; rows now ${await page.locator('tbody tr').count()})`);
await openRowMenu(page, page.locator('tbody tr').first(), /Delete/);
await confirm(page, /^button "Delete/);
await after(page, `Teams: delete the LAST team (empty state shown: ${await page.getByText('No teams yet').isVisible()})`);
await L.shot(page, 'f1-teams-after-last-delete');
// API keys: create two (control), revoke one, revoke the last
await L.goto(page, `/dashboard/${o.orgId}/settings/api/rest`);
for (const n of ['key one', 'key two']) {
await page.getByRole('button', { name: 'Create API key' }).first().focus();
await page.keyboard.press('Enter');
await dlg.waitFor();
await page.keyboard.type(n);
await L.tabTo(page, /^button "Create key/);
await page.keyboard.press('Enter');
await page.getByText('Your API key').first().waitFor({ timeout: 10000 });
await L.tabTo(page, /^button "Done/);
await page.keyboard.press('Enter');
await dlg.waitFor({ state: 'detached', timeout: 10000 }).catch(() => {});
await L.sleep(800);
say(`CONTROL API keys create "${n}" -> Done -> focus ${await L.focusedDesc(page)}`);
}
await openRowMenu(page, page.locator('tbody tr').first(), /Revoke/);
await confirm(page, /^button "Revoke/);
await after(page, 'API keys: revoke a key (one row remains)');
await openRowMenu(page, page.locator('tbody tr').first(), /Revoke/);
await confirm(page, /^button "Revoke/);
await after(page, `API keys: revoke the LAST key (Create API key buttons now ${await page.getByRole('button', { name: 'Create API key' }).count()})`);
// Members: remove a member
await L.addMember(browser, o, 'editor', 'Eve Editor');
await L.goto(page, `/dashboard/${o.orgId}/settings/members`);
await openRowMenu(page, page.locator('tbody tr', { hasText: 'Eve Editor' }), /Delete|Remove/);
await confirm(page, /^button "(Delete|Remove)/);
await after(page, 'Members: remove a member');
// WebDAV: Escape (control) and confirm (the row stays, marked revoked, without its Revoke button)
await L.api(o.ctx, 'POST', `/api/app/webdav/app-passwords?orgId=${o.orgId}`, { label: 'Finance laptop' });
await L.goto(page, `/dashboard/${o.orgId}/settings/api/webdav`);
const revoke = page.getByRole('button', { name: /^Revoke/ }).first();
await revoke.focus();
await page.keyboard.press('Enter');
await dlg.waitFor();
await page.keyboard.press('Escape');
await dlg.waitFor({ state: 'detached' }).catch(() => {});
await L.sleep(400);
say(`CONTROL WebDAV revoke > Escape -> focus ${await L.focusedDesc(page)}`);
await revoke.focus();
await page.keyboard.press('Enter');
await confirm(page, /^button "Revoke/);
await after(page, 'WebDAV: revoke an app-password (row stays as "revoked", its Revoke button goes)');
// AI providers: delete a credential from its row menu
await L.api(o.ctx, 'POST', `/api/app/provider-credentials?orgId=${o.orgId}`, { providerSlug: 'openrouter', authMethod: 'api-key', name: 'Router key', secret: 'fake-key-t70-router-not-a-real-secret' });
await L.api(o.ctx, 'POST', `/api/app/provider-credentials?orgId=${o.orgId}`, { providerSlug: 'openai', authMethod: 'api-key', name: 'OpenAI key', secret: 'fake-key-t70-openai-not-a-real-secret' });
await L.goto(page, `/dashboard/${o.orgId}/settings/providers`, 2000);
await openRowMenu(page, page.locator('tbody tr', { hasText: 'OpenAI key' }), /Delete/);
await confirm(page, /^button "Delete/);
await after(page, 'AI providers: delete a credential (one row remains)');
// Contacts: Escape returns focus (control, restoreFocusRef wired); confirm does not
for (const n of ['Ada Contact', 'Bob Contact']) await L.api(o.ctx, 'POST', `/api/app/contacts?orgId=${o.orgId}`, { name: n, email: `${n.split(' ')[0].toLowerCase()}@example.test`, source: 'manual_import' });
await L.goto(page, `/dashboard/${o.orgId}/contacts`);
await openRowMenu(page, page.locator('tbody tr').first(), /Delete/);
await dlg.waitFor();
await page.keyboard.press('Escape');
await dlg.waitFor({ state: 'detached' }).catch(() => {});
await L.sleep(400);
say(`CONTROL Contacts row menu > Delete > Escape -> focus ${await L.focusedDesc(page)}`);
await openRowMenu(page, page.locator('tbody tr').first(), /Delete/);
await confirm(page, /^button "Delete/);
await after(page, 'Contacts (restoreFocusRef wired): delete a contact (one row remains)');
// CONTROL: Competences revoke restores focus to its table region (restoreFocusRef={tableRegionRef})
const g = await L.api(o.ctx, 'POST', `/api/app/governance/competences?orgId=${o.orgId}`, { userId: o.userId, competence: 'contract-review' });
await L.goto(page, `/dashboard/${o.orgId}/settings/governance/competences`, 2000);
const revokeBtn = page.locator('tbody tr', { hasText: 'contract-review' }).getByRole('button').last();
say('competence fixture ->', g.status, '| row control =', await revokeBtn.getAttribute('aria-label').catch(() => null) ?? await revokeBtn.innerText());
await revokeBtn.focus();
await page.keyboard.press('Enter');
if (await page.getByRole('menu').isVisible().catch(() => false)) { await L.focusMenuItem(page, /Revoke/); await page.keyboard.press('Enter'); }
await confirm(page, /^button "Revoke/);
say(`CONTROL Competences: revoke a grant (the row leaves the Active list) -> focus ${await L.focusedDesc(page)}`);
} finally {
say('--- console/http log ---', log.length ? '' : '(none)');
for (const l of log) say(l);
L.fs.writeFileSync(L.path.join(L.ROOT, 'evidence/proof-f1-delete-focus.log'), out.join('\n') + '\n');
await browser.close();
}
})().catch((e) => { console.error(e); process.exit(1); });probes/lib.cjs
// TALE-70 local audit probe helpers. Local stack only: SPA http://localhost:3000 (vite preview of the
// production build, proxying /api, /events, /dav to the backend on 127.0.0.1:3005). Every probe mints its
// own synthetic organization and accounts through the local sign-up door; nothing else is touched.
const path = require('node:path');
const fs = require('node:fs');
const ROOT = process.env.T70_ROOT || path.join(process.env.HOME, '.cache/t70');
const { chromium } = require(path.join(ROOT, 'tale/node_modules/playwright-core'));
const BASE = 'http://localhost:3000';
const ORIGIN = { origin: BASE };
const PW = 'TaleAudit!Passw0rd';
const SHOTS = path.join(ROOT, 'evidence/shots');
async function launch() {
return chromium.launch({
executablePath: '/opt/ms-playwright/chromium-1194/chrome-linux/chrome',
headless: true,
args: ['--disable-dev-shm-usage'],
});
}
async function newContext(browser, opts = {}) {
return browser.newContext({
baseURL: BASE,
serviceWorkers: 'block',
viewport: opts.viewport ?? { width: 1280, height: 900 },
locale: opts.locale ?? 'en-US',
colorScheme: opts.colorScheme ?? 'light',
reducedMotion: 'reduce',
});
}
async function api(ctx, method, url, data) {
const r = await ctx.request.fetch(url, { method, data, headers: ORIGIN });
const text = await r.text();
let body = text;
try { body = JSON.parse(text); } catch { /* keep text */ }
return { status: r.status(), body };
}
function stamp(label) { return `${label}-${Date.now().toString(36)}`; }
/** A fresh owner with a fresh organization (sign-up + organization/create + set-active). */
async function freshOrg(browser, label, opts = {}) {
const s = stamp(label);
const email = `t70-${s}@tale.test`;
const ctx = await newContext(browser, opts);
const su = await api(ctx, 'POST', '/api/auth/sign-up/email', { email, password: PW, name: `Owner ${label}` });
if (su.status !== 200) throw new Error(`sign-up ${email}: ${su.status} ${JSON.stringify(su.body)}`);
const org = await api(ctx, 'POST', '/api/auth/organization/create', { name: `T70 ${s}`, slug: `t70-${s}` });
if (org.status !== 200) throw new Error(`org create: ${org.status} ${JSON.stringify(org.body)}`);
await api(ctx, 'POST', '/api/auth/organization/set-active', { organizationId: org.body.id });
return { ctx, orgId: org.body.id, email, userId: su.body.user.id, stamp: s, name: `Owner ${label}` };
}
/** A second account added to the owner's organization with `role`, in its own browser context. */
async function addMember(browser, owner, role, name, opts = {}) {
const email = `t70-${owner.stamp}-${name.toLowerCase().replace(/[^a-z0-9]+/g, '-')}@tale.test`;
const ctx = await newContext(browser, opts);
const su = await api(ctx, 'POST', '/api/auth/sign-up/email', { email, password: PW, name });
if (su.status !== 200) throw new Error(`sign-up ${email}: ${su.status} ${JSON.stringify(su.body)}`);
const add = await api(owner.ctx, 'POST', `/api/app/members?orgId=${owner.orgId}`, { userId: su.body.user.id, role });
if (add.status !== 200) throw new Error(`add member ${role}: ${add.status} ${JSON.stringify(add.body)}`);
await api(ctx, 'POST', '/api/auth/organization/set-active', { organizationId: owner.orgId });
return { ctx, email, name, userId: su.body.user.id, memberId: add.body.memberId };
}
function watch(page, sink, tag = '') {
page.on('console', (m) => { if (['error', 'warning'].includes(m.type()) && !BENIGN.some((b) => b.test(m.text()))) sink.push(`${tag}[console.${m.type()}] ${m.text().slice(0, 300)}`); });
page.on('pageerror', (e) => sink.push(`${tag}[pageerror] ${String(e).slice(0, 300)}`));
page.on('response', (r) => { if (r.status() >= 400 && r.url().includes('/api/')) sink.push(`${tag}[http ${r.status()}] ${r.request().method()} ${r.url().replace(BASE, '')}`); });
}
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
/** One-line description of document.activeElement. */
const focusedDesc = (page) => page.evaluate(() => {
const e = document.activeElement;
if (!e || e === document.body) return 'BODY';
const name = (e.getAttribute('aria-label') || e.innerText || e.getAttribute('placeholder') || e.value || '').trim().split('\n')[0].slice(0, 60);
const role = e.getAttribute('role');
return `${e.tagName.toLowerCase()}${role ? `[role=${role}]` : ''} "${name}"`;
});
async function shot(page, name, opts = {}) {
fs.mkdirSync(SHOTS, { recursive: true });
const p = path.join(SHOTS, `${name}.png`);
await page.screenshot({ path: p, fullPage: opts.fullPage ?? false });
return p;
}
/** Horizontal overflow of the document and of every element wider than the viewport. */
const overflow = (page) => page.evaluate(() => {
const vw = document.documentElement.clientWidth;
const doc = document.documentElement.scrollWidth;
const wide = [];
for (const el of document.querySelectorAll('body *')) {
const r = el.getBoundingClientRect();
if (r.width > 0 && (r.right > vw + 1) && getComputedStyle(el).position !== 'fixed') {
// skip descendants of a horizontally scrollable ancestor (a table frame that scrolls on purpose)
let p = el.parentElement, clipped = false;
while (p && p !== document.body) {
const cs = getComputedStyle(p);
if (/(auto|scroll|hidden|clip)/.test(cs.overflowX)) { clipped = true; break; }
p = p.parentElement;
}
if (!clipped) wide.push(`${el.tagName.toLowerCase()}.${String(el.className).slice(0, 60)} right=${Math.round(r.right)}`);
}
}
return { viewport: vw, scrollWidth: doc, docOverflows: doc > vw + 1, wide: wide.slice(0, 8) };
});
/** Visible toasts (sonner region). */
const toasts = async (page) => (await page.locator('[role="region"] li').allInnerTexts()).map((s) => s.replace(/\s*\n+\s*/g, ' ').trim()).filter(Boolean);
/** Every toast shown since the page loaded (a MutationObserver installed before any script runs). */
const TOAST_RECORDER = () => {
window.__toasts = [];
const seen = new WeakSet();
const scan = () => {
for (const li of document.querySelectorAll('[role="region"] li')) {
if (seen.has(li)) continue;
const text = (li.innerText || '').replace(/\s*\n+\s*/g, ' ').trim();
if (text) { seen.add(li); window.__toasts.push(text); }
}
};
new MutationObserver(scan).observe(document, { subtree: true, childList: true, characterData: true });
};
async function recordToasts(ctx) { await ctx.addInitScript(TOAST_RECORDER); }
const allToasts = (page) => page.evaluate(() => window.__toasts || []);
// The /events SSE stream keeps the network busy, so never wait for networkidle.
async function goto(page, url, settleMs = 1200) {
await page.goto(url, { waitUntil: 'domcontentloaded' });
await page.locator('main').first().waitFor({ timeout: 15000 }).catch(() => {});
await sleep(settleMs);
}
// Harness artefacts (serviceWorkers: 'block', font preload hints, the route prefetcher's miss note).
const BENIGN = [/Service Worker registration blocked by Playwright/, /Service worker registration failed TypeError: Cannot read properties of undefined \(reading 'waiting'\)/, /was preloaded using link preload but not used/, /\[prefetch\] no 0\.5 row/];
module.exports = { recordToasts, allToasts, launch, newContext, api, freshOrg, addMember, watch, sleep, focusedDesc, shot, overflow, toasts, goto, BASE, ORIGIN, PW, ROOT, SHOTS, fs, path };
/** With a menu open, move keyboard focus with ArrowDown until the focused item matches `re`. */
async function focusMenuItem(page, re) {
await page.getByRole('menu').waitFor();
await sleep(150);
for (let i = 0; i < 12; i++) {
const cur = await focusedDesc(page);
if (/menuitem/.test(cur) && re.test(cur)) return cur;
await page.keyboard.press('ArrowDown');
await sleep(120);
}
throw new Error(`menu item ${re} never took focus`);
}
/** Inside an open dialog, Tab until the focused element matches `re`. */
async function tabTo(page, re, max = 12) {
for (let i = 0; i < max; i++) {
const cur = await focusedDesc(page);
if (re.test(cur)) return cur;
await page.keyboard.press('Tab');
await sleep(80);
}
throw new Error(`Tab never reached ${re}; at ${await focusedDesc(page)}`);
}
Object.assign(module.exports, { focusMenuItem, tabTo });
Activity
fix(ui): keep keyboard focus in the list after a confirmed row delete
fix(ui): keep keyboard focus in the list after a confirmed row delete
fix(ui): keep keyboard focus in the list after a confirmed row delete
tale-code-bot commentedon Oct 29, 2026
Closing as completed. This is already fixed on
mainby #4273 ("fix(ui): keep keyboard focus in the list after a confirmed row delete"), merged on 2026-10-13 as7ef870b40e7785caa44e9c1a0b50c3a65d3c74f9. The body of #4273 had no closing keyword, so this issue stayed open.Evidence, checked at
main0da08205168e8c882a67cd3255f3e29eb1a99f77:The fix is on
main.7ef870b4is an ancestor ofmain; the GitHub compare showsmain80 commits ahead and 0 behind.What the fix does.
useRestoreFocus(packages/ui/src/hooks/use-restore-focus.ts) gains a fallback (tale:restore-focus-lost) for when the opener,restoreFocusRefand the menu button are all gone.DataTablemountsuseRowFocusRescue(packages/ui/src/components/data-table/data-table.tsx:415). It moves focus to the next row's control, the row above, the create action, or a named region.Tests (from the Coder run on task TALE-36): each suite was run on
mainand again with only fix(ui): keep keyboard focus in the list after a confirmed row delete #4273's production diff reverse-applied.mainuse-restore-focus.test.ts+data-table-focus.test.tsxdata-table-focus.browser.test.tsx(Chromium)webdav-settings.test.tsx+competences-page.test.tsxThe Escape/cancel cases (bug(platform): credential and member row-menu dialogs drop keyboard focus to the page body #3715) pass either way.
Not covered: no real-Chromium test exists for the WebDAV list. It is covered by jsdom tests and by the manual keyboard box
A11Y-A21. If such a test is wanted, it belongs in a separate test-only issue.Tracked as TALE-36 on the Development board.