Skip to content

fix(notifications): keep focus after a partial clear of the only remaining stack - #28566

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/23000-partial-clear-focus
Nov 3, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/23000-partial-clear-focus

Conversation

@cruisercohen

@cruisercohen cruisercohen commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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

  • The neighbour choice for clears that leave other rows: unchanged.
  • Delete retry or failure messaging: unchanged.

What changed (motivation → approach → change)

Symptom: focus on <body> after the partial clear. Cause: both notes were targets, so neighbourOf returns null; the stack shrinks to one note, so the focused header clear unmounts; the refocus effect in NotificationFeed.tsx then reaches its else 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: new mac/panel test a partial clear of the only stack hands focus to the row that survived, placed next to a 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>.
  • Not run locally: vitest does not start on this host (stale shared node_modules under 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

🤖 AI-assisted PR 🤖

@cruisercohen
cruisercohen requested review from a team and KiroCrewCaptain as code owners November 2, 2026 21:44
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of e3014e38dbf9f8380c7c3364fffa10926609fbb5 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: a small focus fallback, limited to the branch where focus had already been lost, fixes the root cause.

Notes

  • The fallback goes to the first [data-notif-row] in the whole feed, not to the note that survived this clear. If the stored neighbour row was removed separately while the clear ran, focus jumps to the top of the feed. Trying a surviving member of r.gone before the first row would land focus on "the row that survived", which is what the Goal promises.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of e3014e38dbf9f8380c7c3364fffa10926609fbb5 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 ships

Inventory (2 items) — 2 justified

Intent: after a partly failed keyboard clear of the only notification stack, keep keyboard focus in the feed on the row that survived. FIX.

  1. After that partial clear, focus goes to the first surviving row's open control instead of falling to <body>. — justified
  2. A new mac/panel test covering the lone-stack partial clear. — justified

[FIRST-PRINCIPLES-REVIEWED] e3014e3

Description read

[DESCRIPTION-READ] e564820e22c44208c0d858851927079659f03f910510452680d66bf1a41e305f

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of e3014e38dbf9f8380c7c3364fffa10926609fbb5 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed e3014e38dbf9f8380c7c3364fffa10926609fbb5 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] e3014e3

Verdict parsed from the review's SHA-scoped output markers for commit e3014e38dbf9f8380c7c3364fffa10926609fbb5.

False positive or not applicable? A repository writer can comment:
/ai-review override fable e3014e38dbf9f8380c7c3364fffa10926609fbb5 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of e3014e38dbf9f8380c7c3364fffa10926609fbb5 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e3014e3

False positive or not applicable? A repository writer can comment:
/ai-review override gpt e3014e38dbf9f8380c7c3364fffa10926609fbb5 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 3, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 3, 2026 01:07

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@KiroCrewCaptain
KiroCrewCaptain merged commit 3062916 into main Nov 3, 2026
152 of 160 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/23000-partial-clear-focus branch November 3, 2026 01:08
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(notifications): keep focus after a partial clear of the only remaining stack

2 participants