Skip to content

refactor(ui): retain picker focus and option refs - #174206

Merged
steipete merged 2 commits into
mainfrom
solid2/w-idiom-components-picker-refs
Oct 16, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-idiom-components-picker-refs

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The select picker re-finds its own sheet-back button and option rows through DOM queries and wraps unowned callbacks in unnecessary untrack calls.

User Impact

Focus restoration, keyboard navigation, scrolling the highlighted option, native sheet behavior, and all existing tags and selectors stay unchanged.

Why This Change Was Made

The view retains its sheet-back button and keyed option elements through refs. A retiring keyed row removes only its own entry. Three deliberate untracked reads remain for the native sheet lifetime, synchronous menu-owner trigger identity, and keyed row identity. Microtask, settled, and event callbacks need no extra untracking.

Evidence

Check Result
Picker behavior and browser unit files 37 existing cases passed once
UI typecheck / targeted lint Passed
Independent P2 review Scoped-clean
Production Knip Inherited failure on head and exact base: unused SynologyChatAccountRaw export in extensions/synology-chat/src/types.ts; byte-identical logs
Base/head production builds and strict performance Passed: 339696 → 339676 B gzip startup JS; 7 JS requests; CSS 38786 B / 1 request
Broad UI and E2E Requested with ci:full

No appearance or layout change; no screenshot delta. Startup raw bytes and lazy boundaries are unchanged. The final braces-only lint correction does not change the reviewed or tested behavior.

Metrics

One production file, select-picker-view.tsx, against 9db9baeb763dc0cdea8ba3979ff0e259ccff8508:

Metric Before After
loc 612 609
controller 0 0
createEffect 3 3
createRenderEffect 0 0
untrack 8 3
addEventListener 0 0
querySelector 0 0
classStrings 0 0
flush 0 0
ownerCapture 0 0

The checklist query regex excludes generic calls; actual DOM queries drop 2 → 0. All three effects synchronize the native overlay/scroll state.

Full CI attribution

Full run 38900282625 failed only chat-provider-review.e2e.test.ts > Control UI mocked Gateway E2E > reviews provider findings before explicit continuation and waits for the authoritative row (plus the aggregate): it timed out at line 115 waiting for the continuation RPC after a plain dialog button click. That exact test passed scheduled main run 38894297213, job 116951151480, in 2119 ms. This is not an identical inherited failure.

Source/flow review supports an unrelated provider-review timeout. The actual tested merge ab63d311d4e562bae22be643a9a226608c21ff01 has ordered parents 242fff2254ebc47baf01a05e7814e6de40d25861 and this PR head. The provider-review owner/helper/test, modal adapter/renderer, overlay lifecycle and registry have identical blobs on that base, tested merge, PR head and passing main. This flow never opens a picker. The changed refs are local to each picker; the removed untracking surrounds settled/microtask/open callbacks and does not alter the dialog or its RPC admission.

The public timeout capture shows a connected, ready page, a paused composer and no browser crash; it does not identify which live admission check or click step failed. No E2E replay was used to claim a fix. The native admin evidence preserves this uncertainty, the passing-main result, the exact failure and the separate investigated local Knip failure.

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

clawsweeper Bot commented Oct 16, 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 16, 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-16T12:29:49.999302Z f29976c 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f29976c960

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return;
}
const node = list.querySelector<HTMLElement>("[data-active]");
const node = optionElements.get(active() ?? "");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Keep a null highlight distinct from the empty option

When filtering produces no matching rows in a picker that includes the common value: "" option, the menu machine sets active() to null, but this lookup aliases that state to the empty-value row. That row is hidden and has zero bounds, so revealInScrollRegion treats it as above the list and resets scrollTop; the previous [data-active] lookup found no node and preserved the user's scroll position. Guard active() === null before consulting the map so only an actually highlighted empty-value option is revealed.

AGENTS.md reference: ui/AGENTS.md:L36-L40

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces picker DOM queries with retained element refs and removes redundant untracking.

Example: Open a native sheet picker using its trigger.

  • Before: Initial focus finds the back button with a DOM query.
  • After: Initial focus uses the retained back-button ref.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused refactor has reported browser coverage, but the null-highlight lookup changes observable scrolling behavior.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied validation reports browser cases and builds, without a shipped-entry-point demonstration of the changed ref path.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes
User problem: No existing user-visible defect is claimed; picker behavior is intended to remain unchanged.
Reason: The maintainer-authored direction follows the established ref-based Solid cleanup and keeps selection and overlay ownership in their existing owners.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this maintainer-authored refactor open; the retained-row lookup introduces a scrolling regression when no enabled option is highlighted.

Priority: P3
Reviewed head: f29976c9601f1a5f8f3861a27846b2110de6c14e

Before merge

  • Keep a null highlight distinct from the empty-value option (P2) - When the observer picker retains an unavailable catalog, its model rows are disabled while the empty-value Disabled choice remains mounted. Filter to enough model rows to keep the list scrollable, scroll down, then append a trailing space to the query. The menu has no enabled result and keeps its highlight null, but this lookup selects the hidden empty-value row. Its zero bounds make revealInScrollRegion move scrollTop toward the beginning even though nothing is highlighted; the previous [data-active] query found no node and preserved the position. Skip the lookup when active() is null while continuing to support an actually highlighted empty-string option.

Findings

  • [P2] Keep a null highlight distinct from the empty-value option — ui/src/components/select-picker-view.tsx:304

Tests

  • Missing end-to-end proof: The reported existing browser cases do not demonstrate preserved scroll position for disabled-only filtered results containing a hidden empty-value option.
Agent review details

How this fits together

The shared Control UI picker receives options and selection callbacks, delegates highlighting to the menu machine, and renders focusable sheets or popovers.

flowchart LR
  A[Picker callers] --> B[Picker view]
  B --> C[Menu machine]
  B --> D[Overlay lifecycle]
  C --> E[Option refs and scrolling]
  D --> E
Loading

Technical review

Best possible solution:

Retain the refs while skipping row lookup when the menu highlight is null.

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

Source establishes a stable null highlight for disabled-only search results and a hidden empty-value row that the new lookup incorrectly reveals; no browser reproduction was run.

Is this the best way to solve the issue?

Retained refs fit the repository's Solid guidance, provided null remains distinct from the valid empty-string option.

Full review comments:

  • [P2] Keep a null highlight distinct from the empty-value option — ui/src/components/select-picker-view.tsx:304
    When the observer picker retains an unavailable catalog, its model rows are disabled while the empty-value Disabled choice remains mounted. Filter to enough model rows to keep the list scrollable, scroll down, then append a trailing space to the query. The menu has no enabled result and keeps its highlight null, but this lookup selects the hidden empty-value row. Its zero bounds make revealInScrollRegion move scrollTop toward the beginning even though nothing is highlighted; the previous [data-active] query found no node and preserved the position. Skip the lookup when active() is null while continuing to support an actually highlighted empty-string option.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Picker focus, scrolling, and callback tracking keeps the original intent (ecdc40d: The shared Solid migration preserved keyboard navigation, focus restoration, selected-row visibility, and native overlay behavior.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm --dir ui test src/components/select-picker.behavior.browser.test.ts --project browser
  • OPENCLAW_UI_WEBKIT=1 pnpm --dir ui test src/components/select-picker.behavior.browser.test.ts --project webkit
  • pnpm --dir ui test src/components/select-picker.browser.test.tsx --project browser
  • git diff --check

What I checked:

PR surface

Source -3. Total -3 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 91 94 -3
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 91 94 -3

Labels

Label changes:

  • add P3: This is a focused internal UI cleanup with a limited, recoverable scrolling defect.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is a focused internal UI cleanup with a limited, recoverable scrolling defect.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 16, 2026, 8:39 AM ET / 12:39 UTC.

@steipete
steipete merged commit 8fda964 into main Oct 16, 2026
105 of 109 checks passed
@steipete
steipete deleted the solid2/w-idiom-components-picker-refs branch October 16, 2026 12:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* refactor(ui): bind picker focus and rows through refs

* style(ui): brace picker row cleanup condition
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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant