Repository navigation
fix(platform): hand a focused retry to the list when a refresh swaps it - #3937
Conversation
Review of #3814, swept past the keyed alerts: with nothing loaded, a list's failure is DataTable's error state, and a refresh the reader did not start (the tab regaining focus, another session's change) swaps it for the loading state. A Try again the reader had focused went with it, and the focus dropped to the page (Chromium, the knowledge list at 4afccb1). - `useFocusHandoff` is CatalogLoadError's handoff, now shared: a callback ref whose element, leaving with the focus inside, hands the focus to `onFocusLost` a frame later. Focus the reader moved elsewhere stays. - ErrorDisplayCompact takes `onFocusLost`; DataTable passes its new `onErrorFocusLost` to its error state.
Review of #3814, swept past the keyed alerts: a knowledge list that never loaded shows the table's error state, and a refresh the reader did not start swapped it for the loading state, taking a focused Try again and dropping the focus to the page — while the refresh ran, after it failed again, and after it healed (Chromium at 4afccb1: another session's hub upload, and the window regaining focus). The documents list shares the state. - Both lists pass their region as the table's `onErrorFocusLost`, the target a manual retry already moves focus to. Focus the reader moved elsewhere stays. - Regression tests: a focused, unpressed Try again in the error state through a background refresh that fails again and then heals, and focus moved elsewhere. Manual box KNOW-A7 adds the window-refocus path.
a477ad7 to
2c259ee
Compare
|
Independent review complete at 2c259ee. No blocker found in this scoped handoff. I ran 60 shared component tests and20 Knowledge/Documents client tests locally. In Chrome, a local harness rendered this exact head's real DataTable and useListReadRecovery: a focused retry handed focus to the named list region during background loading, repeated failure and recovery; focus deliberately moved to another connected control stayed there; Tab+Enter retry recovered with region focus. The harness uses synthetic state, not a native server or full authenticated session. Documents wiring is covered by its executed client regression. No production tests. React Doctor:91/100, one DataTable complexity warning, no errors. Reused dependency packages mean the local run is complemented by exact-head CI, not presented as a fresh frozen-lock install. All50 reported CI checks are completed without a failing/pending result. |
Follow-up to #3814 (review r4134167039), part of #3777. The review asked for a sweep of the other failure notices after a keyed alert dropped a focused Try again. #3814 fixed the four keyed alerts before it merged. The sweep found one more path that loses focus the same way, and this PR fixes it.
The problem
A knowledge list that never loaded shows DataTable's error state (#3814 put Try again there instead of "No knowledge entries yet"). A refresh the reader did not start swaps that state for the loading state while it runs:
A Try again the reader had focused, but not pressed, was removed with it, and the focus dropped to the page body. Focus stayed on the body while the refresh ran, after the refresh failed again, and after the read healed.
Reproduced in Chromium on the CI bundle of #3814's merged head
4afccb13b, against a local synthetic stack, with two triggers: another session's hub upload and a window refocus. The Documents list uses the same state.What changed
useFocusHandoff(@tale/ui, internal) isCatalogLoadError's handoff, extracted and now shared. It is a callback ref: when its element leaves with the focus inside, the focus goes toonFocusLosta frame later, once the replacement has mounted. Focus the reader moved elsewhere stays where it is.CatalogLoadErrornow uses it, with no change in behaviour.ErrorDisplayCompactgains an optionalonFocusLost, andDataTablegains an optionalonErrorFocusLostfor its error state. Both are additive, and nothing changes for callers that pass neither.data-table.mdandlist-page.md, manual boxKNOW-A7(window-refocus path), and the automation-map row.Not changed:
DataTablebehaviour, and a manual retry works the same way.TaskReadAlert(fix(platform): search with the board filters and recover failed reads #3906) keeps its own copy of the handoff. Adopting the hook there is a small follow-up.How I verified it
DataTableandErrorDisplayCompactunit tests.ErrorDisplayCompactdropping the ref: 2 tests.DataTabledropping the prop: 1 test.@tale/uisuites (error boundaries, data table, catalog,useListPage, entity view): 205/205.lint:manual,check-guide,oxfmt --checkandoxlint --type-aware --type-checkon the changed files are all clean.Native Chromium on the exact head
2c259ee31. CI bundle served locally, against a local backend with synthetic data only. The read under test answered 503; background refreshes came from a second session's writes or a window refocus. No screen reader was run; focus and roles were read from the DOM and the accessibility tree.4afccb13b, the same steps left focus on the page body in all three phases.CatalogLoadErrornow uses the shared hook:a477ad76b, which has the same app code.CI at
2c259ee31: every check passes. The first run, ona477ad76b, failed the Browser job inuse-resizable.browser.test.tsx: a Sheet width of 383.9999 against 384. That test failed onmainat19f18f6cbthe same way and passed on the nextmainrun, so it is a flake unrelated to this change. I rebased ontomainto get a fresh run.