Repository navigation
fix(platform): preserve notification switch focus while saving - #4265
Merged
Merged
Conversation
yannickmonney
commented
Oct 4, 2026
yannickmonney
left a comment
Contributor
Author
There was a problem hiding this comment.
Independent review of PR #4265 at 09d275795122de984e9e950dee0ccee703cf7364: accepted, no blockers
Reviewer: agent #4 5f5307c9, run 79fb2fa4 (TALE-606). Author: Codex #2 7b86c233, run 8de68806 (TALE-251). The contract is TALE-251 / #3819. Base is main a9a19afdc, which is also the PR's merge base, so this head already includes current main.
Contract checks (jsdom)
| Check | Result | Evidence |
|---|---|---|
| Focus stays on the switch during the pending save, and the next Tab continues from it | Pass | The PR's tests cover three switches. My probe P1/P4 drives the real useSetNotificationPreferences → useBackendMutation → TanStack path, with only backendFetch mocked. The switch stays enabled, aria-busy="true" and focused, and Tab lands on the next switch (Task status changed). |
| A second activation during the save sends no duplicate | Pass | Real-hook probe, while the save is pending: Space, Enter, user.click and fireEvent.click on the same switch, plus a click on Mentions. backendFetch is called once. After the save settles, one more Space sends exactly one save. Mutation check: removing if (isPending) return; turns the 3 PR keyboard tests red (called 1 times, but got 2 times) and probe P1 red (6 calls). |
| A failure reverts the value and keeps focus | Pass | There is no optimistic update. The switch renders server data, so it never shows the new value before a successful refetch. After a rejected save, real-hook probe P2 shows aria-checked="true" (the stored value), focus still on the switch, aria-busy="false", the switch enabled, and a retry sending again. The PR's failure test asserts the same with the stubbed hook. |
| Locked Review requests control unchanged | Pass | The diff changes disabled={isLockedOn || isPending} to disabled={isLockedOn}. For taskReview, isLockedOn is always true, so the switch is disabled in every state, as before. aria-busy={isPending} is unchanged. Probe P1: disabled with aria-checked="true" during and after the save, and a click on it sends nothing. The three existing #2651 tests pass. |
Regression fails on main |
Pass | The PR's test file on main's source: the 5 new tests fail at expect(toggle).not.toBeDisabled() and the 8 existing tests pass. My probe on main: P1 fails at the same line. P4 shows that on main a pending Tab does not reach the next switch, because every switch is disabled, so the PR's Tab assertion is a second tripwire beyond the disabled check. |
What I ran (at the exact head unless noted)
bunx vitest run --config vitest.ui.config.ts --maxWorkers 1on the page test file plussettings-toggle-row.test.tsx: 21/21 pass (13 + 8).- The same page test file on
maina9a19afdc's source: 5 failed / 8 passed, and the 5 failures are exactly the new tests. - My real-hook probe (4 tests): 4/4 pass at head; 1 failed / 3 passed on
main(P1, atnot.toBeDisabled()). - Guard mutant (
if (isPending) return;removed): 4 failed / 13 passed (the 3 PR keyboard tests and probe P1). Restored withgit checkout. bunx oxlint --type-awareon both changed files: exit 0.oxfmt -c .oxfmtrc.json --check: both files clean.
The author's claims match what I reproduced: 5 new tests red on main, 21/21 at head, lint and format clean. I did not reproduce the author's scoped TypeScript run.
Non-blocking notes
- Same-tick double activation (already on
main, not a regression). Twoclick()s in one task, before React re-renders withisPending = true, send 2 saves on both head andmain(probe P3: 2 calls on each). The guard readsisPendingfrom render state, and TanStack only notifies after a macrotask. Human input can't produce this in practice. A ref-based in-flight flag would close it if wanted. - The PR's tests stub the mutation hook with a synchronous
useStatestand-in, so they don't exercise TanStack's real pending timing. My real-hook probe shows the same behaviour, so this isn't a blocker, but a test on the real hook would be sturdier. - During a save, the other switches silently ignore activation. They look enabled with
aria-busy="true"while the handler drops the input. That meets the contract. Optionally,aria-disabledon the other rows would also tell assistive-technology users why nothing happened. - jsdom has no Chrome focus fixup. On
main, jsdom keeps focus on the disabled switch (probe P4). The jsdom proof of the bug is therefore thedisabledattribute plus the Tab order, not the focus drop itself.
Unrun proof
- Real Chrome and the AX tree: the focus drop on
main, focus retention at head, the screen-reader announcement ofaria-busy, and the toast's focus behaviour. This was a light-only slot. - TypeScript type-check of the changed files (the author reports 0 diagnostics; CI runs it).
- The full platform suite and a whole-workspace
tsc. - CI: at 08:41Z all 5 workflows (Build, Checks, Commitlint, E2E, SAST) were queued at "Candidate source / Resolve source". I did not wait on, rerun or cancel them, and I count none of them as passing.
Verdict: accept at 09d275795122de984e9e950dee0ccee703cf7364, with no blockers. Merging stays with TALE-359 and needs green CI at this head.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aria-busystate instead of native disabling.Verification
a9a19afdc: all five new cases fail on the pending native-disabled state; eight existing tests pass.git diff --checkpasses.Closes #3819