Repository navigation
fix(notifications): keep focus after a partial clear of the only remaining stack - #28566
Conversation
…ining stack Fixes #23000
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: a small focus fallback, limited to the branch where focus had already been lost, fixes the root cause. Notes
[DESIGN-REVIEWED] e3014e3 Description read[DESCRIPTION-READ] f73c3d85635f13f27905121ba1a407d09d3639d1e4241be378f5e422ce0ce141 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: this is a one-branch focus fix for a filed issue (#23000), at mechanism level, with a test that fails on base. What this change shipsInventory (2 items) — 2 justifiedIntent: after a partly failed keyboard clear of the only notification stack, keep keyboard focus in the feed on the row that survived. FIX.
[FIRST-PRINCIPLES-REVIEWED] e3014e3 Description read[DESCRIPTION-READ] e564820e22c44208c0d858851927079659f03f910510452680d66bf1a41e305f That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff only changes which existing row gets keyboard focus after a partial clear fails. It adds or changes no control, so there is nothing a screenshot could show. [UX-REVIEWED] e3014e3 Description read[DESCRIPTION-READ] 3a6734c294726119b7595c4850288bc35aa887f1dbd603bde7abee7a9767f94e That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: after a partial clear of the only remaining stack, focus moves to the first surviving notification row instead of dropping to the page body.
Problem / Motivation
Goal: after a keyboard clear of the only remaining notification stack partly fails, focus stays in the feed on the row that survived, so arrow-key stepping keeps working.
The feed has one two-note stack and nothing else. The user expands it, keyboard-confirms the header clear, one delete succeeds and the other fails. Focus ends on
<body>and Up/Down stop moving through the feed until the user presses Tab. Raised by the GPT 6.1 lane on #22744 and filed as #23000.Why it matters
Keyboard and screen-reader users lose their place in the feed after a partial failure, which is exactly when they need to look at the row that is left. Low harm, but it breaks the focus hand-off the feed promises for every other clear.
Not a goal
What changed (motivation → approach → change)
Symptom: focus on
<body>after the partial clear. Cause: both notes were targets, soneighbourOfreturnsnull; the stack shrinks to one note, so the focused header clear unmounts; the refocus effect inNotificationFeed.tsxthen reaches itselse if (r.settled)branch with no row to focus and drops the transfer.Change: in that settled branch, focus the first surviving
[data-notif-row] [role="button"]before discarding the transfer. The branch is only reached when focus is on<body>or on the unmounted clearing control: focus the user moved elsewhere, and a clearing control that survived, still return earlier as before. An all-rejected clear still drops the transfer before it settles, so nothing moves there.Backwards compatibility
Compatible: focus handling only, in the one case where focus was previously lost.
Removes nothing: the diff only adds a focus fallback and a test.
Tests
NotificationFeed.senderStacks.test.tsx: newmac/paneltesta partial clear of the only stack hands focus to the row that survived, placed next toa day clear whose deletions commit one at a time still hands focus to the next row. A lone two-note stack, the newer delete succeeds and the older is rejected; the header clear unmounts and focus lands on the surviving row's open control. On main focus stays on<body>.node_modulesunder Node 24), so CI covers the frontend suite.Proof: not provable -- frontend test
Manual verification
N/A — unit coverage sufficient: the change is a single focus call inside the refocus effect, exercised end to end by the new jsdom test in both variants.
Screenshots / video
Why no screenshot: nothing renders differently; the only change is which existing control receives focus after an asynchronous partial failure, which the new test asserts directly.
Related Issues
Fixes #23000
Sibling sweep
Swept: git grep -n "refocus" -- website/src/components/notifications/
Siblings: none -- the refocus transfer exists only in the NotificationFeed effect; other clears route through it.
Pattern harvest
Not generalizable: a fallback missing from one branch of a component-specific focus hand-off.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.
🤖 AI-assisted PR 🤖