Repository navigation
Description
P3 · WCAG 2.1 SC 2.4.3 (Focus Order) · Reproduced locally at d351611bdd942ffeed758147ccaf57e70877125a (origin/main, 2026-09-28) with the keyboard in Chromium.
On Settings → Connectors and Settings → AI providers, every dialog opened from a credential row's actions menu drops keyboard focus to <body> when it closes. That covers Edit credential, Replace token / API key / username & password and Delete. The Settings → Members row menu (Edit) behaves the same way, through the same missing wiring. A keyboard or screen-reader user lands at the top of the document and has to tab back through the settings rail, the toolbar and every row to reach where they were.
Reproduction
- Tab to a credential row's actions button ("Actions for GitHub") and press Enter.
- Arrow to Edit credential (or Replace token, or Delete) and press Enter. The dialog opens and takes focus correctly.
- Press Escape (or activate Cancel).
- Check
document.activeElement.
Expected: Focus returns to the row's "Actions for GitHub" button that opened the menu. That is the WAI-ARIA dialog pattern, and what Contacts' row menu, the Add credential button and the OAuth apps Configure/Remove buttons on the same page do.
Actual: document.activeElement is <body> for all three dialogs. The same happens on the AI providers table and on the Members table's Edit (frozen output below).
User impact
After every credential edit, secret rotation or cancelled delete, and after every member edit, keyboard users lose their place in the table and must re-navigate from the top of the page. On a long list this repeats for every row they work through.
Cause
- The dialogs open from menu items that unmount with the menu, so the dialog primitive has nothing to return focus to unless it is given a ref.
@tale/ui'sEntityRowActionsexposestriggerRef(entity-row-actions.tsx:48), and the dialogs acceptrestoreFocusRef.CredentialRowActionswires neither (credential-row-actions.tsx:193–245), and neither doesmember-row-actions.tsx.- Compare contact-row-actions.tsx:31, 82–106, which passes
triggerRef={menuTriggerRef}andrestoreFocusRef={menuTriggerRef}to each dialog. - Sweep hint, from source reading only and not exercised in this audit:
team-row-actions.tsx,automation-row-actions.tsxandproject-row-actions.tsxalso pass notriggerRef.
Executable local proof and controls
probes/proof-focus.cjs and probes/proof-providers-shared.cjs (below) run against fresh synthetic organizations, keyboard only; p4-members-focus.cjs runs on the seeded dev org. Frozen output at d351611bd:
setup: fresh org aFc5gCEU3YCn9Tcct0A37sg1ypL0PkOY with one GitHub credential and one contact
credential row > Edit credential: {"item":"div \"Edit credential\"","focusWhileOpen":"input \"\"","focusAfterEscape":"BODY"}
CONFIRMED closing "Edit credential" (opened from the row menu) leaves focus on <body>
credential row > Replace token: {"item":"div \"Replace token\"","focusWhileOpen":"input \"\"","focusAfterEscape":"BODY"}
CONFIRMED closing "Replace token" (opened from the row menu) leaves focus on <body>
credential row > Delete: {"item":"div \"Delete\"","focusWhileOpen":"div \"Delete credential\"","focusAfterEscape":"BODY"}
CONFIRMED closing "Delete" (opened from the row menu) leaves focus on <body>
control: Add credential dialog closed with Escape -> focus button "Add credential"
control: contacts row > Edit: {"item":"div \"Edit\"","focusWhileOpen":"input \"\"","focusAfterEscape":"button \"Open menu\""}
CONTROL a row menu with restoreFocusRef returns focus to its trigger
--- AI providers (proof-providers-shared.cjs) ---
fixture env provider credential -> 200 {"credentialId":"434b93f3-9f13-4939-89d1-241f136eb838"}
AI providers row > Delete: {"item":"div \"Delete\"","focusAfterEscape":"BODY"}
CONFIRMED the AI providers table (same CredentialRowActions) loses focus the same way
--- Members (p4-members-focus.cjs, seeded dev org) ---
members row trigger: Open menu
members row > Edit: {"item":"div \"Edit\"","focusWhileOpen":"input \"\"","focusAfterEscape":"BODY"}
Controls (same run):
- Contacts' row menu → Edit → Escape returns focus to its "Open menu" trigger.
- The Add credential dialog returns focus to "Add credential".
- In the exploration probe
p4-oauthcard-focus.cjs, the OAuth apps card's Configure and Remove dialogs return focus to their buttons.
Mocked boundary
None. Real SPA, backend and PostgreSQL; keyboard only.
Local stack (loopback only): a detached worktree of d351611bd with bun install --frozen-lockfile; a fresh PostgreSQL 16.13 + pg_search 0.22.6 + pgvector 0.8.1 cluster bootstrapped like the tale-db image plus services/db/init-scripts; the backend from services/platform (node --experimental-transform-types --import ./backend/node-loader.mjs backend/main.ts, TALE_ROLE=all, PORT=3005, SITE_URL=http://localhost:3000, an empty TALE_CONFIG_DIR, TALE_CONFIG_BUILTIN_DIR=configs/platform/custom, TALE_DEV_SEED_USER=1, TALE_ALLOW_OPEN_SIGN_UP=true, locally generated ENCRYPTION_SECRET_HEX/BETTER_AUTH_SECRET); the SPA via TALE_BACKEND_URL=http://127.0.0.1:3005 bunx --bun vite --port 3000; Chromium 141 driven by the worktree's playwright-core 1.58.2. The backend ran with NODE_USE_ENV_PROXY=1 HTTPS_PROXY=HTTP_PROXY=http://127.0.0.1:9 NO_PROXY=127.0.0.1,localhost,::1, so every non-loopback fetch failed at a dead proxy: no real provider, mailbox or external service was reachable. Each proof mints its own synthetic organization through POST /api/auth/sign-up/email + POST /api/auth/organization/create.
Deduplication
- Bug: Dialogs and the command palette do not return focus to their trigger on close (focus falls to <body>) — WCAG 2.4.3 #1988 (closed) fixed the general dialog focus return.
- Bug: logout confirmation dialog does not return focus to its trigger on close #2681 (closed) fixed the same menu-item-unmount case for the logout confirmation only.
- Searched the bodies of all 1,035 issues in every state for focus return/restore,
document.body,EntityRowActionsand row-actions keyboard: no open issue covers the credential row menu. - Bug: task dialog leaves keyboard focus on the background board #3557 was the task dialog.
- The jsx-a11y entries in
.agents/repo.md's lint debt ledger concern non-interactive elements, not focus return. - Found by the TALE-78 local audit.
probes/lib.cjs (shared helpers)
// Shared helpers for the TALE-78 local audit probes. Everything targets the local stack only:
// SPA http://localhost:3000 (proxying /api to the backend on :3005), fake vendor https://127.0.0.1:4443.
const { chromium } = require('/agent/.runtime/home/scratch/tale78/tale/node_modules/playwright-core');
const fs = require('node:fs');
const BASE = 'http://localhost:3000';
const ORIGIN = { origin: BASE };
const PW = 'TaleAudit!Passw0rd';
const USERS = {
owner: { email: '[email protected]', password: 'TaleDev!Passw0rd' },
};
async function launch() {
return chromium.launch({ executablePath: '/opt/ms-playwright/chromium-1194/chrome-linux/chrome', headless: true });
}
async function newContext(browser, opts = {}) {
const context = await browser.newContext({ baseURL: BASE, ignoreHTTPSErrors: true, serviceWorkers: 'block', viewport: opts.viewport ?? { width: 1280, height: 900 }, locale: 'en-US' });
return context;
}
async function signIn(context, who) {
const u = typeof who === 'string' ? (USERS[who] ?? { email: who, password: PW }) : who;
const r = await context.request.post('/api/auth/sign-in/email', { data: { email: u.email, password: u.password }, headers: ORIGIN });
if (!r.ok()) throw new Error(`sign-in ${u.email} -> ${r.status()} ${await r.text()}`);
return r.json();
}
async function api(context, method, path, data) {
const r = await context.request.fetch(path, { method, data, headers: ORIGIN });
let body = null;
const text = await r.text();
try { body = JSON.parse(text); } catch { body = text; }
return { status: r.status(), body };
}
function watch(page, sink) {
page.on('console', (m) => { if (['error', 'warning'].includes(m.type())) sink.push(`[console.${m.type()}] ${m.text().slice(0, 300)}`); });
page.on('pageerror', (e) => sink.push(`[pageerror] ${String(e).slice(0, 300)}`));
page.on('response', (r) => { if (r.status() >= 400 && r.url().includes('/api/')) sink.push(`[http ${r.status()}] ${r.request().method()} ${r.url().replace(BASE, '')}`); });
}
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
module.exports = { launch, newContext, signIn, api, watch, sleep, BASE, ORIGIN, PW, USERS, fs };
// ---- fresh synthetic organizations for self-contained proofs ------------------------------------
async function freshOrg(browser, label) {
const stamp = `${label}-${Date.now().toString(36)}`;
const email = `proof-${stamp}@tale.test`;
const ctx = await newContext(browser);
const su = await api(ctx, 'POST', '/api/auth/sign-up/email', { email, password: PW, name: `Proof ${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: `Proof ${stamp}`, slug: `proof-${stamp}` });
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, stamp };
}
async function addMember(browser, owner, role) {
const email = `proof-${owner.stamp}-${role}@tale.test`;
const ctx = await newContext(browser);
const su = await api(ctx, 'POST', '/api/auth/sign-up/email', { email, password: PW, name: `Proof ${role}` });
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)}`);
return { ctx, email, memberId: add.body.memberId };
}
const creds = async (ctx, orgId) => (await api(ctx, 'GET', `/api/app/connector-credentials?orgId=${orgId}`)).body.credentials;
const vendorControl = (q) => fetch(`https://127.0.0.1:4443/control?${q}`).then((r) => r.json());
const toasts = async (page) => (await page.locator('[role="region"] li').allInnerTexts()).map((s) => s.replace(/\s*\n+\s*/g, ' ').trim()).filter(Boolean);
const focusedDesc = (page) => page.evaluate(() => { const e = document.activeElement; if (!e || e === document.body) return 'BODY'; return `${e.tagName.toLowerCase()} "${(e.getAttribute('aria-label') || e.innerText || '').trim().split('\n')[0].slice(0, 50)}"`; });
Object.assign(module.exports, { freshOrg, addMember, creds, vendorControl, toasts, focusedDesc });probes/proof-focus.cjs
// PROOF: dialogs a credential row's actions menu opens (Edit credential, Replace token, Delete) drop keyboard focus
// to <body> when closed. Contacts' row menu, which wires EntityRowActions' triggerRef into restoreFocusRef,
// returns focus to its trigger; the page's own Add credential button does too.
// Mocked boundary: none (real SPA, backend, Postgres); keyboard only (Enter / arrow keys / Escape).
const L = require('./lib.cjs');
async function cycle(page, trigger, itemRe) {
const t = page.getByRole('button', { name: trigger }).first();
await t.focus(); await page.keyboard.press('Enter'); await page.waitForTimeout(300);
for (let i = 0; i < 8; i++) { if (itemRe.test(await L.focusedDesc(page))) break; await page.keyboard.press('ArrowDown'); }
const item = await L.focusedDesc(page);
await page.keyboard.press('Enter'); await page.waitForTimeout(600);
const open = await L.focusedDesc(page);
await page.keyboard.press('Escape'); await page.waitForTimeout(600);
return { item, focusWhileOpen: open, focusAfterEscape: await L.focusedDesc(page) };
}
(async () => {
const browser = await L.launch();
const owner = await L.freshOrg(browser, 'focus');
const o = owner.orgId;
await L.api(owner.ctx, 'POST', `/api/app/connector-credentials?orgId=${o}`, { connectorSlug: 'github', authMethod: 'bearer', name: 'GitHub', secret: { token: 'ghp_focus_000000000000' } });
await L.api(owner.ctx, 'POST', `/api/app/contacts?orgId=${o}`, { firstName: 'Focus', lastName: 'Control', email: '[email protected]', source: 'manual_import' });
const page = await owner.ctx.newPage();
await page.goto(`/dashboard/${o}/settings/connectors`);
await page.getByRole('button', { name: 'Actions for GitHub' }).waitFor({ timeout: 30000 });
console.log(`setup: fresh org ${o} with one GitHub credential and one contact`);
for (const [label, re] of [['Edit credential', /Edit credential/], ['Replace token', /Replace token/], ['Delete', /"Delete"/]]) {
const r = await cycle(page, 'Actions for GitHub', re);
console.log(`credential row > ${label}: ${JSON.stringify(r)}`);
if (r.focusAfterEscape === 'BODY') console.log(`CONFIRMED closing "${label}" (opened from the row menu) leaves focus on <body>`);
}
// Control 1: a dialog opened by a real button on the same page.
const add = page.getByRole('button', { name: 'Add credential' }).first();
await add.focus(); await page.keyboard.press('Enter'); await page.waitForTimeout(500); await page.keyboard.press('Escape'); await page.waitForTimeout(500);
console.log(`control: Add credential dialog closed with Escape -> focus ${await L.focusedDesc(page)}`);
// Control 2: a row menu that wires triggerRef/restoreFocusRef (contacts).
await page.goto(`/dashboard/${o}/contacts`);
await page.getByRole('button', { name: 'Open menu' }).first().waitFor({ timeout: 30000 });
const c = await cycle(page, 'Open menu', /Edit/);
console.log(`control: contacts row > Edit: ${JSON.stringify(c)}`);
if (c.focusAfterEscape.includes('Open menu')) console.log('CONTROL a row menu with restoreFocusRef returns focus to its trigger');
await browser.close();
})().catch((e) => { console.error(e); process.exit(1); });probes/proof-providers-shared.cjs
// Scope check on the sibling surface that renders the same credential table/dialogs: AI providers.
// Fixture: an `env` provider credential naming a SYNTHETIC environment variable (unset; nothing is resolved or called).
const L = require('./lib.cjs');
async function cycle(page, trigger, itemRe) {
const t = page.getByRole('button', { name: trigger }).first();
await t.focus(); await page.keyboard.press('Enter'); await page.waitForTimeout(300);
for (let i = 0; i < 8; i++) { if (itemRe.test(await L.focusedDesc(page))) break; await page.keyboard.press('ArrowDown'); }
const item = await L.focusedDesc(page);
await page.keyboard.press('Enter'); await page.waitForTimeout(600);
await page.keyboard.press('Escape'); await page.waitForTimeout(600);
return { item, focusAfterEscape: await L.focusedDesc(page) };
}
(async () => {
const browser = await L.launch();
const owner = await L.freshOrg(browser, 'prov');
const o = owner.orgId;
const made = await L.api(owner.ctx, 'POST', `/api/app/provider-credentials?orgId=${o}`, { providerSlug: 'openrouter', authMethod: 'env', name: 'OpenRouter env', envName: 'TALE_PROVIDER_KEY_TALE78_SYNTHETIC_A' });
console.log('fixture env provider credential ->', made.status, JSON.stringify(made.body).slice(0, 160));
const page = await owner.ctx.newPage();
await page.goto(`/dashboard/${o}/settings/providers`);
await page.getByRole('button', { name: 'Actions for OpenRouter env' }).waitFor({ timeout: 30000 });
const r = await cycle(page, 'Actions for OpenRouter env', /"Delete"/);
console.log(`AI providers row > Delete: ${JSON.stringify(r)}`);
if (r.focusAfterEscape === 'BODY') console.log('CONFIRMED the AI providers table (same CredentialRowActions) loses focus the same way');
// Refusal on the provider surface: rename onto a taken name.
await L.api(owner.ctx, 'POST', `/api/app/provider-credentials?orgId=${o}`, { providerSlug: 'openrouter', authMethod: 'env', name: 'OpenRouter backup', envName: 'TALE_PROVIDER_KEY_TALE78_SYNTHETIC_B' });
await page.reload(); await page.getByRole('button', { name: 'Actions for OpenRouter backup' }).waitFor({ timeout: 30000 });
await page.getByRole('button', { name: 'Actions for OpenRouter backup' }).click();
await page.getByRole('menuitem', { name: 'Edit credential' }).click();
const ed = page.getByRole('dialog');
await ed.getByLabel('Name').fill('OpenRouter env');
await ed.getByRole('button', { name: 'Save' }).click();
await page.waitForTimeout(1500);
const inline = (await ed.innerText()).split('\n').filter((l) => /already|exists|taken|in use/i.test(l));
console.log(`AI providers rename onto a taken name: inline=${JSON.stringify(inline)} toasts=${JSON.stringify(await L.toasts(page))}`);
await browser.close();
})().catch((e) => { console.error(e); process.exit(1); });
Activity
yannickmonney commentedon Sep 29, 2026
This is a browser confirmation of two more sites with the same missing wiring, at
e3943c5f5c1e69c39309bb8f5b9cf5e63ce41672. The run used a keyboard only, one fresh synthetic organization, and the real SPA build, backend and PostgreSQL.team-row-actions.tsxsweep hint above): the row menu's Edit and Delete dialogs drop focus to<body>on Escape.api-key-row-actions.tsxwas not in the sweep list; it rendersEntityRowActionswithouttriggerRefand gives its dialog norestoreFocusRef.automation-row-actions.tsxandproject-row-actions.tsx.Confirming the delete is a different gap: focus drops even on Contacts, which is wired. It is filed as #3791, and the fix for this issue does not cover it.
probes/proof-3715-sweep.cjs (uses lib.cjs from #3791)
This was found by the TALE-70 local audit, which used no production system.