Skip to content

refactor(ui): keep navigation focus targets with their owners - #177149

Merged
steipete merged 1 commit into
mainfrom
solid2/w-zero-navigation-refs
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/w-zero-navigation-refs

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The shell still searched rendered markup to find the navigation controls that should regain keyboard focus.

User Impact

No intended visual or interaction change. Collapsing desktop navigation keeps focus on the selected rail view; dismissing the mobile drawer returns focus to the visible toggle. Existing tags, classes, routes, and selectors remain unchanged.

Why This Change Was Made

Register the topbar and conditional chat-header toggles through the existing shell/outlet registry, and let the sidebar expose its active rail button. Registrations follow Solid component lifetimes and release when a branch or bridge unmounts. The shell reads these owned handles instead of querying descendant markup. The shared ref factory has two callers; it adds no effects, listeners, dependencies, or eager page imports.

Evidence

Base: fd547069429314c8a8cfd68360dc23278e6c6653. Head: a7139210257d84cea296f3b3097e5e75f3ed5ae3. The rebase preserved the reviewed patch exactly.

Check Result
Focused unit tests 77 passed: sidebar rail 30, shell chrome 3, chat header 44; each file run once
Types Default tsrs-backed pnpm tsgo:ui; app, components, and chat test graphs passed
Lint and formatting Targeted checks passed; existing sidebar reactivity warning unchanged
Production Knip Passed on the final rebased head
Independent review and simplify No actionable P0–P2 findings; retained one registry and one sidebar owner
Base and head production builds Both passed, same machine
Strict startup gzip 337,885 → 337,894 B (+9 B); CSS requests 1 → 1
Strict New Session / chat gzip 1,045,907 → 1,046,301 B / 1,472,224 → 1,472,566 B; both below budgets
Focus and screenshots Desktop 1280×800 and mobile 393×852; focus assertions passed; all three before/after PNG pairs byte-identical
Broad coverage ci:full requested for shell, sidebar, and chat; app navigation-focus test left to CI

Production LOC: 2,990 → 3,039 (+49). Tests: 2,180 → 2,309 (+129). Total: 13 files, +222/−44. Growth is registration, lifecycle cleanup, and regressions that reconnect retired nodes so connected-element filtering cannot conceal stale registry entries.

Checklist: touched production files Before After
Controller pattern 0 0
createEffect 1 1
createRenderEffect 0 0
untrack 2 2
addEventListener 0 0
querySelector / querySelectorAll, including typed calls 2 0
Class-string construction / flush 0 / 0 0 / 0
Owner captures 2 2

Existing coupled-sidebar survivors are outside the app/lib lane: presentation commit effect at app-sidebar.tsx:264, plugin fallback mounting at app-sidebar.tsx:223–225, and intentional keyed-identity snapshots at app-sidebar-rail.tsx:193,544. None was added or broadened here. Across this lane since its original baseline, effects are 20 → 6 (−70%), render effects 2 → 0, owned DOM listeners 3 → 0, and queries 43 → 5; remaining queries belong to foreign-DOM islands. The separate layout cleanup remains in #176965.

The attached screenshots use synthetic data only and were inspected in full. They cover desktop collapsed focus, mobile drawer open, and mobile dismissed focus, in before/after order. The capture used the existing production build and screenshot helper; initial standalone harness setup errors were corrected by running it in a Vitest worker. That first worker also built an unused bundle once; the final head capture used an explicit prebuilt-server configuration. No full local E2E suite or parity run was executed.

Before: desktop collapsed navigation focus

After: desktop collapsed navigation focus

Before: mobile drawer

After: mobile drawer

Before: mobile dismissed focus

After: mobile dismissed focus

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T08:40:08.989163Z a713921 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete enabled auto-merge (squash) October 19, 2026 08:44
@steipete
steipete merged commit 0b953c4 into main Oct 19, 2026
101 of 102 checks passed
@steipete
steipete deleted the solid2/w-zero-navigation-refs branch October 19, 2026 08:56
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces navigation focus queries with lifecycle-bound toggle registrations and a sidebar-owned active-button handle.

Example: Collapse Pages navigation at 1280×800.

  • Before: The shell searches sidebar markup and restores focus to the Pages rail button.
  • After: The sidebar supplies its Pages button directly, preserving the same keyboard focus.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused ownership cleanup with inspected production UI proof, meaningful lifecycle coverage, and no actionable findings; pending CI remains governed by the existing gate.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The supplied production-build browser captures exercise desktop collapse and mobile drawer opening and dismissal, with passing focus assertions reported at the reviewed head; all six inspected screenshots preserve the intended presentation.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-directed cleanup removes shell knowledge of descendant markup while preserving existing controls, focus policy, and lazy boundaries.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: the maintainer-directed refactor preserves navigation focus through existing owners, with no actionable correctness or security findings; exact-head CI is still pending.

Priority: P3
Reviewed head: a7139210257d84cea296f3b3097e5e75f3ed5ae3

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI shell handles navigation toggles and focus restoration; sidebar and header components provide mounted controls through the existing shell/outlet registry.

flowchart TD
  A[Keyboard or navigation action] --> B[Shell chrome owner]
  C[Topbar and chat header] --> D[Shell and outlet registry]
  E[Sidebar owner] --> F[Active rail button]
  D --> B
  F --> B
  B --> G[Restore keyboard focus]
Loading

Technical review

Best possible solution:

Retain the focused owner-held registration cutover and let the existing exact-head CI gate complete.

Do we have a high-confidence way to reproduce the issue?

This refactor claims no existing user-visible failure; source confirms the markup queries being replaced, and supplied production captures exercise preserved navigation focus.

Is this the best way to solve the issue?

The change uses the existing registry and sidebar owner, removes both superseded queries, and gives each conditional control an explicit cleanup lifetime.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4cba3b50298f.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduced patch: The introduced hunks replace both focus-target queries, extend the existing registry with an optional key, and pair registration with component cleanup. (ui/src/app/route-element-ref.ts:5, a7139210257d)
  • Existing registry remains authoritative: The shell combines its registered elements with the outlet's elements; the new lookup preserves visible DOM order and connected-element filtering. (ui/src/app/app-host.tsx:118, a7139210257d)
  • Current main comparison: Fetched main retains the selector-based implementation, and its comparison with the merge base shows no intervening changes to the touched production owners. (ui/src/app/navigation-surface.ts:109, 4cba3b50298f)
  • Supplied production UI proof: Inspected all six linked screenshots: desktop collapsed navigation, mobile drawer open, and mobile dismissed focus before and after. The PR records production-build capture and passing focus assertions at the reviewed head; presentation is preserved. (a7139210257d)
  • Distinct lifecycle coverage: Added coverage checks visible DOM ordering, topbar bridge disposal, conditional chat-header disposal, and hidden or detached sidebar controls; reconnecting retired nodes prevents connected-element filtering from masking leaked registrations. (ui/src/components/shell-chrome.test.tsx:133, a7139210257d)
  • Live merge and CI state: GitHub reports the reviewed head as mergeable, with one Gateway E2E check still running and the aggregate CI gate pending; no failing product check was reported. (a7139210257d)

Likely related people:

  • Peter Steinberger: Raw commit 7310bf1 adds ui/src/app/route-elements.ts:53 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7310bf167db7; files: ui/src/app/route-elements.ts)
  • Vyctor H. Brzezowski: Raw commit f15b825 adds ui/src/app/navigation-surface.ts:42 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f15b825f6416; files: ui/src/app/navigation-surface.ts)

PR surface

Source +49, Tests +129. Total +178 across 13 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 92 43 +49
Tests 4 130 1 +129
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 222 44 +178

Review metrics

Metric Value Why it matters
Production versus test growth Production +49 LOC; tests +129 LOC Growth implements shared registration cleanup and sidebar handles, with distinct ordering and lifecycle regressions; it adds no effects, listeners, dependencies, or persisted state.

Labels

Label changes:

  • add P3: This is a behavior-preserving Control UI ownership cleanup with bounded focus-lifecycle changes.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a behavior-preserving Control UI ownership cleanup with bounded focus-lifecycle changes.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 19, 2026, 4:55 AM ET / 08:55 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant