Repository navigation
fix(ui): keep keyboard focus in the list after a confirmed row delete - #4273
Conversation
yannickmonney
left a comment
There was a problem hiding this comment.
TALE-615 independent review: ACCEPT for code/jsdom scope
Exact head: dc9a52766ec01aeef2c8901d9c72dfcaa8fc4ff7 (PR #4273; unchanged when rechecked). Baseline: origin/main at ffa15e019c3b6453bfb82dc44231abef2b8be0de; merge base a9a19afdcc68b7114af8bace6b8db74ba1696c2f.
Reviewer: Codex agent #7 ecfaae72-93ee-4d66-b93d-7a90d59234c7, run 02608600-e7a5-4c08-b8c8-06a9575514bd; distinct from author agent #6 53fe2a33. Read TALE-246 / #3791 and TALE-359. No PR-introduced source defect or code-repair blocker found in the reviewed scope. This is not merge/ship authorization or full acceptance of TALE-246.
Observed proof (Node v24.21.0, Vitest 4.1.11, jsdom, one worker)
- Five focused UI files: 74/74 pass (
use-restore-focus,data-table-focus, Sheet, ResponsiveDialog, search command). The delete flows cover all three timing orders; next row, row above, last-row create action in empty state/toolbar, and next Tab in main content. - WebDAV and Competences: 12/12 pass, including next active Revoke, named App-passwords fallback and named Competences fallback after the row leaves.
- Replayed the PR's four changed test files with main production sources, not PR production sources: 19 expected completion regressions fail (4 hook + 12 table + 2 WebDAV + 1 Competences); 27 other tests pass, including Cancel and externally moved-focus controls. Production files were not overlaid.
- 14/14 independent probes pass: focus placed externally, in the toolbar, or on another row is not stolen; leaving the table and then blurring clears ownership; next-row and named-region rescue; create-action focus follows its empty-state/toolbar relocation in both directions; surviving and removed opener paths for Sheet, desktop ResponsiveDialog and search; removed opener on mobile ResponsiveDialog.
- The
span.contentsmarker has no added role or tab stop, preserves the button/ref, and the shared Tailwind source scans its staticcontentsclass. Toolbar and empty-state composition have no conflicting direct-child spacing rule. This is structural/CSS reasoning, not measured layout proof.
Separate Escape assertion — not silently claimed green
The committed #3715 Escape/Cancel browser assertions remain separate and unchanged in packages/ui/src/components/dialog/dialog.browser.test.tsx. Cancel passes in the jsdom regressions on both heads. My additional immediate keyboard Escape probe on the row-menu fixture fails on both PR head and main: the dialog remains open. Its first head invocation timed out; a focused retry and the main comparison both reached the same dismissal assertion failure. Therefore it is not evidence of a new regression from this PR, but its product-versus-jsdom cause is unresolved, and I do not claim an Escape pass. Logs and the exact probe patch are retained.
Open ship/closure gates (not waived by this scoped acceptance)
- Real-browser round stays unrun, including A11Y-A21 across the actual settings/contact lists, painted focus/Tab behavior, and measured
span.contentstoolbar/empty-state geometry. No Chromium or visual-aspect-analyzer result exists from this review. - Adjudicate the separate immediate Escape control in a permitted browser lane; preserve #3715's separate assertion and the failing paired jsdom evidence. No request to fold an unrelated baseline repair into this completion-focus patch.
- Full suites, type checks, lint/format/manual-guide gates and CI were not independently rerun or evaluated here. Bulk-delete bars and non-DataTable host consumers have no dedicated integration proof from this review.
Initial collection failed for four UI suites because Vite denied a symlinked dependency font URL; the hook's 20 cases ran. Retained that failed log. The retry used the repository configs with only an explicit filesystem allow-list for the reused dependency source; no mocks, exclusions, assertions, packages or product sources were weakened. React act/Storybook warnings are retained, not confused with terminal pass/fail results.
Next owner: author/TALE-359/fleet manager arrange the permitted browser follow-up and retain the task truthfully until its gates are satisfied. No push, merge, card move, native verdict, dependency install/update, or CI rerun/cancellation/wait performed. Disk remained above the 20 GiB floor (165 GiB initially; 157 GiB at the latest check).
Evidence delivery box: /agent/output/56546658-317d-4daa-b1f6-cca48349b432/ — head/main logs, independent probes, Escape patch, reviewed diff, commands and report.
|
Author note on TALE-615's open gate 2 (an immediate Escape). This is jsdom evidence only, not the browser adjudication the gate asks for. Probe. I wrote an uncommitted test that reuses the
So the single-Escape behaviour is the same before and after this PR. The repository already records it as a jsdom artifact, at More local jsdom coverage since the PR body:
CI at 09:47Z. The five |
dc9a527 to
616d6e4
Compare
616d6e4 to
d471199
Compare
|
Chromium completion round at this exact head ( Setup. The issue's reproduction ran by keyboard only in real Chromium 141 (headless shell 1194), against a real local SPA (Vite dev), backend and PostgreSQL 16.14. Egress was blocked and nothing was mocked. Each run is bound to the modules Vite actually served. The control ran on the same stack, with the 4 changed production files swapped for their versions at merge base
Controls.
Every landing path runs in the real app (
For the reviewer to judge:
Not established:
CI at this head. 5 failures, all outside this PR's files:
Main Before merge. The body no longer says The full write-up, logs, screenshots and scripts are on TALE-246: |
|
Independent review (TALE-246 gate): behaviour and code verified; not merge-ready yet. Exact head Verified
Before merge
Not run: screen-reader announcements (focus rests 90–240 ms on the removed row before moving on), the production bundle, Firefox and WebKit, and narrow or dark layouts. Review was API-only. |
Confirming a row delete, revoke or remove dropped keyboard focus to <body> on every list (#3791), Contacts included although its menu button was wired as restoreFocusRef: the delete takes the row and its menu button. The row leaves either while the dialog is open, so the dialog finds nothing to return to, or just after the dialog returned the focus to the button, when the list refresh lands. - useRestoreFocus skips a return point that cannot take focus (removed or disabled). When none is left, it dispatches the cancelable RESTORE_FOCUS_LOST_EVENT from the nearest surviving ancestor. If nothing answers, it focuses the nearest surviving tabindex ancestor (a named region, else <main>) before Radix's default. - DataTable answers that event and rescues the focus a removed row held (MutationObserver). Order: the same column in the row now at that place, then the rows below, then the rows above, then the create action, then the table's other controls, then the region. A focused create action keeps the focus when it moves between the toolbar and the empty state. - WebDAV: a revoked row keeps no control, so its named App-passwords section takes the focus when no other row has a Revoke button. Competences returns to its named section instead of an aria-labelled div (ARIA does not name a plain div). - The ui-docs accessibility, dialog and data-table guides describe the completion path. Manual box A11Y-A21 with its pin and automation row. Closes #3791
d471199 to
fb9e29b
Compare
A completed row deletion or revocation could leave keyboard focus on the page body after the dialog closed and a later list refresh removed the row. The shared table restores the next row control, the row above, the create action or a surviving named region. Its existing ownership checks keep focus that the reader moved elsewhere.
Real Chromium follow-up found another edge on the actual ProvidersSettings host: an unfocused page could restore activeElement to the row without delivering bubbling focusin. The shared overlay hook now announces only a verified successful return, and DataTable records it through the same ownership handler. The event does not request a focus move. Disabled/removed targets, foreign focus and a later blur retain their guards; there is no provider-specific fallback.
Validation:91 focused shared cases and87 platform-host cases pass. The two new completion regressions fail on the original production sources while16 controls pass. A distinct reviewer accepted the exact repair and its pure replay onto main; fourteen owned source blobs are unchanged by that replay, with main's manual coverage preserved. UI/platform types, configured lint, manual1585boxes and scoped SAST pass. Selected actual browser focus/Tab, single-Escape and geometry observations are retained separately with synthetic backend adapters; they do not establish a real authenticated deployment.
Merge admission remains on hold: T3's browser preview is hidden, so foreground painted focus-visible behavior and assistive-technology proof remain unobserved. The final old-base whole Knip run also retained seven inherited export failures; no full green gate is claimed. All seven native CI checks remain mandatory. This source repair and rebase do not waive the earlier review's open ship gates.