Skip to content

perf(website): open project, mic, context and + popovers on the mouse press - #18704

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/press-activation-dropdowns
Oct 20, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/press-activation-dropdowns

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The composer's project chip, microphone source menu, context-usage readout and + menu open the moment the mouse button goes down, like the model and agent chips.

#17536 moved the model and agent chips, the hook "Add skill" button and the Tablist rail to act on the press through usePressActivation. Four hand-rolled popover triggers in the same composer still open on click, which fires on the release. Pressing the model chip opens its list at once, while pressing the project chip next to it shows nothing until the button comes back up.

Why it matters

The project chip, mic menu, context readout and + menu sit in the same row as the model and agent chips. Two speeds in one row reads as lag on the slow ones, and every press on them waits for the release.

Not a goal

  • WorkspacePicker is not converted. Nothing outside its own test imports it, so it has no trigger in the running dashboard.
  • The popovers' own outside-dismiss listeners are unchanged. All four already close on mousedown or pointerdown and skip their trigger.
  • Buttons inside the popovers, such as a mic device row or the auto-compact reset, keep acting on click.

What changed (motivation → approach → change)

Each of these triggers only opens or toggles a popover that the next press closes, so acting on the press loses nothing. The triggers now spread usePressActivation()'s binder in place of onClick. A plain left mouse press opens at pointer-down and the click after the release is swallowed. Keyboard, touch, pen, modified clicks and programmatic click() still open from onClick.

The second press closes rather than closing and reopening because each popover's outside-dismiss skips its trigger: MicSourceMenu skips wrapRef, useContextPopover skips ctxWrapRef, and ProjectPicker skips the anchor rect.

The mic menu focuses its first item on open, and that move now happens at pointer-down, before the browser's mousedown default would focus the trigger and pull focus back out. So usePressActivation (website/src/hooks/usePressActivation.ts) takes a keepFocusOffTrigger option that cancels the mousedown default for a press it handled, and the mic trigger and the project chip set it. ProjectPicker stays mounted, so a reopen to Recent or Favorites mounts its autofocused search box in the pointerdown commit, before mousedown; a first open or Browse focuses later and the guard cancels nothing there. It cancels only when focus has moved off the trigger onto a live element. A closing press unmounts the focused item, focus falls back to <body>, and the default runs so the trigger takes focus and Tab continues from the composer. The context readout and the + menu move no focus on open and do not set it.

Control File Before After
Project chip ChatInput.tsx open on release open on press
Mic source menu trigger MicSourceMenu.tsx open on release open on press
Context-usage readout chat-input/ContextShelf.tsx open on release open on press

Backwards compatibility

Compatible: every trigger still opens from keyboard, touch and programmatic click() as on main. Only the moment a plain mouse press acts moves earlier.

Tests

pressActivationDropdowns.test.tsx drives each trigger with the browser's event order: pointerdown, mousedown, mouseup, then click with detail: 1.

  • The project chip fires onProjectClick once on the press and not again on the release. A keyboard click and a touch tap still fire it, and a press while a response runs does nothing.
  • The + menu trigger (website/src/components/chat-input/attach.tsx) opens on the press, stays open through the release, and closes on a second press without cancelling the mousedown default. Enter, Space and a touch tap still open it.
  • The mic trigger and the context readout open on the press, stay open through the release, and close on a second press. A keyboard click still opens both, and a press outside closes the context popover.
  • A plain press on the mic trigger cancels the mousedown default, and the mic menu's first item holds focus after the press. A closing press and a shift-press leave the default alone. A press on the project chip cancels it when the reopened picker's search box already holds focus, and leaves it alone otherwise.

The press tests fail on origin/main (two of the three + menu tests among them; its keyboard and touch test passes on both), the two focus tests fail without the keepFocusOffTrigger change, and all pass on this branch. vitest related for the changed files runs 486 files and 6,693 tests, all passing. tsc -p tsconfig.app.json and eslint pass.

Manual verification

Checked on fe45278 with Playwright driving real browsers. The script presses with mouse.down(), waits 150 ms, releases with mouse.up(), and reads document.activeElement after each step. WebKit is not installed on this host, so there is no Safari reading.

The project chip ran in Chromium 1243 against a pod gateway built from this head, through the real composer:

  • Open press: after mousedown focus is still on the chip. After release it is on the picker's Project directory path combobox.
  • Close press: focus is on the chip after both mousedown and release. The next Tab goes to the composer's Context usage button.

The mic trigger ran in Chromium 1243 and Firefox, with fake media devices. MicSourceMenu was mounted alone on a scratch Vite page, because a fresh pod has dictation turned off and enabling it needs a speech model:

  • Open press: focus is on the first menuitemradio ("System default") already after mousedown, and it stays there after release.
  • Close press: focus is on the Change input source trigger after both mousedown and release. The next Tab goes to the following control.

On the open press, the chip's picker focuses its combobox on release. The mic menu focuses its item before mousedown finishes. Either way focus ends where the surface put it, not on the trigger.

Screenshots / video

Why no screenshot: only the moment a press acts changes; every rendered pixel matches main.

Related Issues

Fixes #18703

Follow-up to #17536.

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

@Pearcekieser
Pearcekieser requested review from a team and KiroCrewCaptain as code owners October 10, 2026 03:25
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of be8fc67d5baf8c0aaae116b0ae51cde03e415974 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Check the project chip and mic menu in Safari, which wasn't tested: after a press opens or closes them, focus should land where the PR says.

[UX-REVIEWED] be8fc67

Description read

[DESCRIPTION-READ] 93ac4ddb66f31373d721f9c61e50ed7b0a3bd3a3141cb4a651c5ca57804e7421

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 Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of be8fc67d5baf8c0aaae116b0ae51cde03e415974 via the fork AI-review pipeline — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify in a real browser that reopening the project picker to Recent/Favorites keeps focus in the search box. The only test for that case uses a stand-in input.

What this change ships

Inventory (6 items) — 6 justified

Intent: make the four remaining composer popover triggers open on the mouse press, at the same speed as the model and agent chips beside them. This is a FIX (#18703).

  1. The project chip opens its picker on the mouse press instead of the release — justified
  2. The mic source menu opens on the press — justified
  3. The context-usage readout opens on the press — justified
  4. The + menu opens on the press — justified
  5. The mic trigger and the project chip no longer take focus back from the item the opened surface just focused — justified
  6. usePressActivation gains a keepFocusOffTrigger option (PressActivationOptions) — justified

[FIRST-PRINCIPLES-REVIEWED] be8fc67

Description read

[DESCRIPTION-READ] 6272062d36fd12e8c3d6f9dfde6f236c51913d77b7d7779de5405302965c1272

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 Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of be8fc67d5baf8c0aaae116b0ae51cde03e415974 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check the mic menu and project chip in Safari/WebKit before merge: keepFocusOffTrigger cancels the mousedown default, and the author had no WebKit browser to test it.

[DESIGN-REVIEWED] be8fc67

Description read

[DESCRIPTION-READ] 174335646f004309e98e3c6ad187487aacf189b2b87be9b2107140886ee9d72e

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 Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed be8fc67d5baf8c0aaae116b0ae51cde03e415974 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] be8fc67

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed be8fc67d5baf8c0aaae116b0ae51cde03e415974 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] be8fc67

@Pearcekieser
Pearcekieser force-pushed the fix/press-activation-dropdowns branch from d020eca to 98ef695 Compare October 10, 2026 03:58
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased on main at 950be41, with no behaviour change. The only red check on d020eca was SAST (Semgrep), which flagged test-autouse-shared-monkeypatch in test/test_readiness_poll_gate_max_age_14857.py. Main added that fixture in decba81 after this branch's base, so the diff-only scan counted it against this PR. The rebased head 98ef695 changes the same 4 files; the press-activation and hook tests (30 files, 368 tests) and tsc -p tsconfig.app.json pass on it.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 10, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/press-activation-dropdowns branch from 98ef695 to e1da129 Compare October 10, 2026 04:43
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (non-blocking): Opus review on 98ef695, focus returns to the mic trigger after a press opens the menu

Fixed in e1da129. The finding holds. The menu focuses its first item at pointer-down, and the browser's default action for the mousedown of the same press then focuses the trigger, so Tab left an open menu. usePressActivation now takes a keepFocusOffTrigger option that cancels the mousedown default only for a press the hook handled. Keyboard, touch and modified presses keep the default. The mic trigger sets it, and so does the project chip, because ProjectPicker autofocuses its search box on open and had the same problem. The context-usage readout moves no focus and leaves it unset. Two new tests in pressActivationDropdowns.test.tsx fail without the option and pass with it.

note: Frontend Tests (3) on 98ef695 ran all 690 files and 11,331 tests green, then failed on "Worker exited unexpectedly" from the vitest pool. Coverage Gate and Frontend Coverage Merge failed after it because shard 3 never wrote its coverage. This push reruns them.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 10, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/press-activation-dropdowns branch from e1da129 to ebfda82 Compare October 10, 2026 06:04
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (non-blocking): Opus review on e1da129, a closing press left focus on <body>

Fixed in ebfda82. The finding holds. On the second press the surface unmounts its focused item at pointer-down, and the cancelled mousedown then kept the trigger from taking focus, so Tab restarted from the top of the page. keepFocusOffTrigger now cancels the mousedown default only when document.activeElement is a live element other than the trigger and <body>, which is true after an opening press and false after a closing one. The mic and project chip tests now also press a second time and check that the default runs. Both tests fail on the e1da129 hook and pass on this head.

note: Backend Tests (Windows) (2) on e1da129 failed on 2 TimeoutErrors in test/test_runtime_cleanup_regression.py (the [load] variants), with 24,621 tests passing. This PR changes only files under website/, so it does not reach that code. The push reruns the job.

@Pearcekieser
Pearcekieser force-pushed the fix/press-activation-dropdowns branch from ebfda82 to fe45278 Compare October 10, 2026 10:24
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): rebased on main d32c084, no behaviour change

On ebfda82, Build Wheel, both Build Desktop jobs, Frontend Lint & Type Check and the offline E2E job failed on gen-ui-index --check reporting ui-index.generated.json as stale. That check arrived in #18443 after this branch's base. Main's #18782 has since regenerated the index, and rerunning npm run gen:ui on this head leaves it unchanged, so the PR is back to its 5 website files.

Frontend Tests (3) on ebfda82 failed one test, GuideLayer.test.tsx "pressing the highlighted control on the last step finishes the guide" (expected 2 entries, got 1), with 11,599 others passing. It passes on this head locally, and nothing under src/guide/ uses usePressActivation. Locally: 38 test files with 738 tests pass, tsc passes, and the index check exits 0.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (blocking): Design Review on fe45278, the focus guard had no real-browser check

The finding holds. The jsdom tests only see defaultPrevented, and the Manual verification section leaned on #17536, which predates keepFocusOffTrigger. The section now records a Playwright run on this head. It presses with mouse.down() and mouse.up() and reads document.activeElement after each step.

The project chip ran in Chromium against a pod built from fe45278. After an opening press, focus is on the picker's Project directory path combobox. After the closing press it is on the chip, and the next Tab reaches Context usage.

The mic trigger ran in Chromium and Firefox, with MicSourceMenu mounted on a scratch page because a fresh pod has dictation off. After an opening press, focus is on the first menuitemradio, and it is already there after mousedown. After the closing press it is on Change input source, and the next Tab reaches the following control.

The timing gap the review raised (the surface focusing after mousedown) is real for the picker. It focuses its combobox on release, and focus still ends there. WebKit is not installed on this host, so there is no Safari reading. No code change.

@Pearcekieser
Pearcekieser force-pushed the fix/press-activation-dropdowns branch from fe45278 to 5043d9a Compare October 12, 2026 18:00
@Pearcekieser

Pearcekieser commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

note (non-blocking): rebased on main, no behaviour change

Head 5043d9a is fe45278 rebased on current main with no conflicts. It touches the same 5 website files, npm run gen:ui -- --check exits 0, and 31 test files with 393 tests pass locally across src/hooks and pressActivationDropdowns.test.tsx. The push lets Design Review read the Manual verification section added on 10-10, which records the Chromium and Firefox focus checks from issuecomment-6096830725.

thought (non-blocking): First Principles concern about the composer + menu still opening on release

That trigger is outside the three this PR converts, which are the ones #18703 lists. Moving it to press activation changes a different menu with its own focus handling, so it belongs in its own PR with its own browser check.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 12, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): E2E log on 16a993a confirms the 1020 s bound, not a spec failure

Run 38687059612 finished: 324 passed, 0 failed, 1 interrupted, 5 did not run, with Playwright at 16.9 m on 1 worker. The bound interrupted member-memory.spec.ts:396, the same file as the interrupted spec on 8a52ef2, 8c58a8a and 023cd5d. No interrupted or failed spec opens the project chip, mic or context popovers. The PR is waiting only on a re-run of this job.

@Pearcekieser
Pearcekieser force-pushed the fix/press-activation-dropdowns branch from 16a993a to f092cc9 Compare October 16, 2026 09:42
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): rebased on main to pick up #19146, no behaviour change

#19146 raised the E2E (stub ACP backend, offline) run ceiling from 1020 s to 1200 s and closed #18185. Four earlier heads of this PR hit the old ceiling with 0 failed specs. f092cc9 sits on current main and changes the same 5 website files. Main's ChatInput.tsx changes merged without conflict. Locally the UI index check exits 0, tsc passes, and vitest over src/hooks, ChatInput and the press-activation test passes 33 files with 396 tests.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 17, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): head f092cc9 checked against current main, no push

Readiness passed on f092cc9, with E2E (stub ACP backend, offline) green under the 1200 s ceiling. green_age.py reports main 277 commits ahead, and ChatInput.tsx is the one same-file overlap. I rebased this commit onto main 52a302b locally: no conflicts, still 5 files, and tsc -p tsconfig.app.json exits 0. Vitest over src/hooks, ChatInput and the component tests, the press-activation test included, passes 33 files with 381 tests. I am not pushing that rebase, because a new head would reset readiness and wait again for fork workflow approval. The head is ready to merge as it stands.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at f092cc9.

The change reads as correct. All three triggers use usePressActivation, the new tests drive the real browser event order, and CI and PR Readiness are green on this head. The earlier r101 items are done: the doc comment moved, and the + menu is tracked in Pearcekieser#37.

One blocker: the First Principles CONCERNS on this head has no reply. Item 4 says keepFocusOffTrigger does nothing visible on the project chip, because ProjectPicker already focuses its input in a requestAnimationFrame (ProjectPicker.tsx L328). Your own Playwright reading also shows focus still on the chip after mousedown. That suggests the guard never cancels for the chip.

To clear: either drop { keepFocusOffTrigger: true } from the project chip, or post a target=first-principles disposition for this head that shows a case where the chip needs it.

— crew-pr-reviewer (r110)

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 18, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/press-activation-dropdowns branch from f092cc9 to 5f49e9e Compare October 18, 2026 18:14
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (blocking): fixed, the project chip no longer sets keepFocusOffTrigger

@iamwhatever this answers r110 and First Principles item 4. The guard was a no-op on the chip. ProjectPicker focuses its search box after it mounts, which is later than the press's mousedown, so at mousedown focus is still on the chip and the guard never cancels. The Playwright reading in the description shows the same thing.

5f49e9e drops { keepFocusOffTrigger: true } from the chip binding in ChatInput.tsx and rewrites the comment above it. The mic trigger keeps the guard, because its menu focuses the first item before mousedown ends. The chip test in pressActivationDropdowns.test.tsx now asserts that a press on the chip leaves the mousedown default alone. The description lines about the chip were updated to match.

The head is also rebased on current main with no conflicts and still changes 5 files. Locally tsc -p tsconfig.app.json, the UI index check and eslint pass, and vitest over src/hooks, ChatInput and the press-activation test passes 34 files with 391 tests.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 18, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

thought (non-blocking): item 4 kept in the hook, because the guard depends on the hook's record of the press

The subtraction would move the mousedown cancel into MicSourceMenu.tsx. The cancel is only safe when the same press already ran onPress at pointer-down, and only the hook knows that. Its onMouseDown returns early unless pressed.current is the trigger, and onPointerDown sets that ref only for a plain left-button mouse press on an enabled control.

An inline handler can't make that check. A React mousedown carries no pointerType, so it would have to guess from activeElement, and that guess goes wrong in two real cases.

  1. Touch. A tap fires the compatibility mousedown after pointerup and before the click that opens the menu. If the composer textarea has focus, activeElement is the textarea, and the inline guard would cancel a default that nothing asked it to cancel.
  2. A modified press, such as shift-press, with focus elsewhere. The hook leaves it on the click path and leaves mousedown alone. An inline guard would see focus on another element and cancel.

Copying the pressed ref into the menu to avoid those cases would duplicate the hook's state in a second place. The option is one boolean, and it keeps that state in one place. It is also the shape the composer + menu will need, since that menu focuses its first item on open as well (tracked in Pearcekieser#37). I'm leaving the code as it is on this head.

@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 Oct 18, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): 5f49e9e checked against current main, no push

Readiness passed on 5f49e9e. green_age.py marks the green stale only for same-directory overlap in website/src/components and website/src/hooks; no file this PR changes moved on main. I rebased this commit onto main 310ad48 locally: no conflicts, still 5 files, tsc -p tsconfig.app.json exits 0, and vitest over src/hooks, ChatInput and the press-activation test passes 34 files with 391 tests. I am not pushing that rebase, because a new head would reset readiness and wait again for fork workflow approval.

@iamwhatever iamwhatever 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.

REQUEST_CHANGES at 5f49e9e.

Our r110 review was wrong to call the chip's keepFocusOffTrigger a no-op, and dropping it brings back the focus bug the Opus lane reported on this head (finding). I'm sorry for the detour.

Why the reopen loses focus:

  • ProjectPicker is always mounted (ComposerDockView.tsx L724-L728), so the last open's rows stay in state (ProjectPicker.tsx L424-L432).
  • On a reopen to Recent or Favorites, the autoFocus search box (L870-L873) mounts in the pointerdown commit. That is the same before-mousedown timing the mic menu relies on.
  • The chip's mousedown default then moves focus back to the chip, so typing to filter goes nowhere. On main the open happens on click, after mousedown, so the search box keeps focus.
  • The rAF focus at L329 covers only the Browse input. That matches your Playwright reading, which saw the chip still focused at mousedown.

Smallest fix: restore { keepFocusOffTrigger: true } on bindProjectPress (ChatInput.tsx L483-L489) and correct the comment. The guard cancels only when focus has already moved to a live element, so the first-open and Browse paths are unchanged. Then replace the "lets the chip take focus" test with a reopen test: cached Recent rows and an autoFocus input that focuses in the press commit. Post a target=fable disposition for the Opus finding.

Your First Principles reply on keeping the option in the hook holds up, and it gets a second caller with this fix. The rest of the change reads as correct, and CI is green. Separately, the + menu follow-up is tracked only in your fork (Pearcekieser#37). Opening it in this repository would let maintainers see it.

I read the source and tests. I did not run them or open a browser.

— crew-pr-reviewer (r111)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (blocking): fixed, the project chip sets keepFocusOffTrigger again

@iamwhatever this answers r111 and the Opus focus finding (issuecomment-6093520460). You're right that the chip needs the guard. ProjectPicker stays mounted, so a reopen to Recent or Favorites renders its cached rows and mounts the autoFocus search box in the pointerdown commit, before mousedown. Without the guard the chip's mousedown default pulls focus back and typing goes nowhere. My 5f49e9e change was wrong to drop it.

3e47da7 restores { keepFocusOffTrigger: true } on bindProjectPress in ChatInput.tsx and rewrites the comment above it to name the reopen case. A first open and Browse focus later, so the guard cancels nothing there. pressActivationDropdowns.test.tsx replaces the "lets the chip take focus" test with two. The first is a reopen whose search box takes focus during the press: the guard cancels, focus stays in the box, and a closing press and a shift-press leave the default alone. The second is an open that has not moved focus by mousedown, where the chip takes focus as usual. The description lines about the chip were changed back to match.

The head is rebased on current main with no conflicts and still changes 5 files. Locally tsc -p tsconfig.app.json, the UI index check and eslint pass, and vitest over src/hooks, ChatInput and the press-activation test passes 35 files with 396 tests.

On the + menu: an upstream issue opened on its own would be claimed by automation with no PR attached, so I'll open it here together with the follow-up PR that converts the menu. Until then it stays tracked in Pearcekieser#37.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): no WebKit run, so the Safari case rests on event order

WebKit is still not installed on this host, so I have no Safari reading for keepFocusOffTrigger. The guard is still safe there because of how Safari handles focus. Safari does not focus a button on a mouse press, so the mousedown default the guard cancels never moves focus to the trigger in the first place. Cancelling it changes nothing. The guard only cancels when focus has already moved onto a live element other than the trigger. A closing press therefore runs the same code as on main, and Tab continues from the same place. The earlier reply on the UX Safari check (issuecomment-6172331735) covers the same reasoning in more detail.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): 3e47da7 checked against current main, no push

Readiness passed on 3e47da7. green_age.py marks the green stale because main gained 21 commits, one of which touches ChatInput.tsx, a file this PR also changes. I rebased this commit onto main 37b4bca locally. It had no conflicts and still changes 5 files. tsc -p tsconfig.app.json exits 0, and vitest over src/hooks, ChatInput and the press-activation test passes 37 files with 417 tests. I am not pushing that rebase, because a new head would reset readiness and wait again for fork workflow approval.

@iamwhatever iamwhatever 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.

REQUEST_CHANGES at 3e47da7.

The r111 defect is fixed. The project chip sets keepFocusOffTrigger again (

{...bindProjectPress<HTMLButtonElement>(el => onProjectClick(el.getBoundingClientRect(), el), { keepFocusOffTrigger: true })}
), the new reopen test pins it, and the Opus finding has its target=fable disposition. All AI lanes pass on this head, and checks are green. Your Safari reasoning answers the WebKit punchline. Nobody has run WebKit, so that part is still argued, not observed.

One blocker remains. The Not a goal section promises the composer + menu conversion as its own PR, but the only tracker is Pearcekieser#37 on your fork. Our rule is that a deferred follow-up needs an issue in kirodotdev/KiroCrew linked from the description, the same as on #19648. r111 called this optional, and I am correcting that here. Please open the issue here (it can say the PR is yours and in progress) and link it, or convert the + trigger in this PR.

I read the source and tests. I did not run them.

— crew-pr-reviewer (r112)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

issue (blocking): fixed, the composer + trigger is converted in this PR

@iamwhatever this answers r112. Instead of keeping the + menu as a deferred follow-up, 112cb6b converts its trigger here, so no deferred item remains and the Not a goal line is gone.

In website/src/components/chat-input/attach.tsx the + button now binds usePressActivation in place of onClick={togglePlus}. A plain mouse press opens the menu at pointer-down and the release does not close it. A second press closes it. Enter, Space and a touch tap still open it from onClick. It does not set keepFocusOffTrigger, because the menu moves no focus when it opens, so the trigger takes focus as usual. The menu's existing outside-dismiss listener already runs on mousedown and skips the trigger's wrapper, so a press on the trigger while open is a toggle.

pressActivationDropdowns.test.tsx adds three + menu tests that drive the real event order. The press-opens and second-press-closes tests fail on the old trigger. The keyboard and touch test passes on both, as it should. The title and description now name the + menu. I'm closing Pearcekieser#37 as done here.

The head is rebased on current main with no conflicts and changes 6 files. Locally tsc -p tsconfig.app.json, the UI index check, npm run i18n:check and eslint pass, and vitest over src/hooks, ChatInput, src/components/chat-input and the press-activation test passes 37 files with 420 tests.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): rebased on main to clear the inherited Harness Parity Gate failure, no behaviour change

Harness Parity Gate failed on 112cb6b in its x-capture check, and Await Fast Gate failed with it. The finding is ACP_BACKENDS_MEMBER_CAPABILITIES [claude]: allowlisted but now proven; delete the entry. This PR changes only website files. The same check fails on this PR's old base 88914fd, and it passes on current main, so the failure came from the base.

be8fc67 is the same commit rebased onto current main with no conflicts, and it still changes the same 6 website files. Locally scripts/check_harness_parity.py exits 0 against main. tsc -p tsconfig.app.json, the UI index check and npm run i18n:check pass, and vitest over src/hooks, ChatInput, src/components/chat-input and the press-activation test passes 37 files with 420 tests.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): the reopen-to-Recent focus case is covered by a stand-in test, not a browser run

That's correct. The Playwright reading in the description covers a first open of the picker, a closing press and the mic menu. It doesn't cover a reopen to cached Recent or Favorites rows. The jsdom test reproduces the timing r111 described: the search input takes focus inside the press handler, before mousedown. It checks that the guard cancels the mousedown default in that case and leaves it alone on a closing press. Whether the real ProjectPicker mounts its autoFocus box in the pointerdown commit is still the reviewer's reading of ComposerDockView.tsx and ProjectPicker.tsx, not something I observed in a browser. The guard is safe either way. If the box takes focus first, the guard keeps it there. If it doesn't, the guard cancels nothing and the chip takes focus as it does on main.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): be8fc67 checked against current main, no push

@iamwhatever readiness passed on be8fc67, and Opus, GPT and First Principles have no findings on it. The r112 change request is answered in issuecomment-6272338862: the + trigger is converted in this PR, so nothing is deferred. Could you re-review when you get a chance?

green_age.py marks the green stale because main gained 52 commits, one of them touching ChatInput.tsx, a file this PR also changes. I rebased this commit onto main 60ba1c8 locally. It had no conflicts. scripts/check_harness_parity.py exits 0, tsc -p tsconfig.app.json passes, and vitest over src/hooks, ChatInput, src/components/chat-input and the press-activation test passes 37 files with 420 tests. I am not pushing that rebase, because a new head would reset readiness and wait again for fork workflow approval.

@iamwhatever iamwhatever 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.

APPROVE at be8fc67.

The r112 blocker is resolved: instead of a deferred follow-up, the composer + trigger is converted in this PR (

{...bindPlusPress<HTMLButtonElement>(togglePlus)}
). Its outside-dismiss listener runs on mousedown and skips the trigger wrapper (
const h = (e: MouseEvent) => {
const t = e.target as Node
if (!plusWrapRef.current?.contains(t) && !plusMenuRef.current?.contains(t)) setPlusOpen(false)
}
document.addEventListener('mousedown', h)
return () => document.removeEventListener('mousedown', h)
), so a second press closes the menu, and the new + tests drive the real event order. The project chip keeps keepFocusOffTrigger, and the guard only cancels mousedown for a press it handled when focus has moved onto a live element (
onMouseDown(e: React.MouseEvent<E>) {
const el = e.currentTarget
if (pressed.current !== el) return
// Cancel only when the press moved focus into something it opened. A
// press that closed the surface unmounted the focused element, so the
// browser's default must be allowed to put focus on the trigger.
const active = el.ownerDocument.activeElement
if (active && active !== el && active !== el.ownerDocument.body) e.preventDefault()
). Nothing is deferred now.

All AI lanes pass on this head, the punchlines have replies, and every check is green. The Safari behaviour still rests on event-order reasoning, not on a WebKit run. One small description nit: the What changed table lists three controls and leaves out the + menu.

I read the source and tests. I did not run them.

— crew-pr-reviewer (r114)

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

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project, mic and context-usage popovers in the composer open on release, not press

2 participants