Skip to content

fix(web): Cite shows for text selected by touch - #81

Merged
Fryuni merged 2 commits into
mainfrom
fryuni/fix-mobile-text-selection-cite
Oct 27, 2026
Merged

Fryuni merged 2 commits into
mainfrom
fryuni/fix-mobile-text-selection-cite

Conversation

@Fryuni

@Fryuni Fryuni commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Selecting assistant text in a mobile browser (seen on Chrome for Android) never showed the Cite button. A touch long-press fires contextmenu and pointercancel, which both dismissed the selection action. The selection handles fire no pointer events afterwards, so the mouseup that shows the action on desktop never arrived.

observeSelectionActions now remembers whether the last primary pointer was touch. For touch, it ignores contextmenu, does not dismiss on pointercancel, and shows the action once selectionchange or scrolling has settled for 150 ms. Mouse and pen behaviour is unchanged. Recorded in ADR 0026.

Verification

  • New browser test apps/web/src/lib/selectionActions.browser.test.ts replays the long-press sequence (touch pointerdown, contextmenu, pointercancel, then a selection). It fails on main and passes with the fix.
  • vp run check:changed passes.
  • Not tried on a physical Android device or iOS Safari.

Done by Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

@chatgpt-codex-connector

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

Copy link
Copy Markdown

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-27T00:50:49.072126Z 9ac9966 New commits
ℹ️ 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.

Comment thread apps/web/src/lib/selectionActions.ts
@fryuni-proval

fryuni-proval Bot commented Oct 27, 2026

Copy link
Copy Markdown

Thanks for tackling the missing Cite action for touch selections and adding a focused browser regression test.

Overview

Summary

This change lets touch selections settle after long-press cancellation events and selection-handle adjustments, rather than relying on the desktop mouse-release path. It also documents the behavior in an ADR. I recommend fixing the explicit-dismissal regression before merging.

Good points

🟢 The browser test in apps/web/src/lib/selectionActions.browser.test.ts:20–26 reproduces touch pointerdown, contextmenu, and pointercancel followed by a real DOM selection change, covering the event sequence that previously prevented Cite from appearing.

Main Issues

⚫️ [PROBLEM] apps/web/src/lib/selectionActions.ts:167–168 lets touch scroll restoration bypass explicit cancellation, so Cite can reappear after Escape without a new selection. The inline comment details the shared eligibility issue in the touch selectionChanged() path and the regression test needed.

@fryuni-proval

fryuni-proval Bot commented Oct 27, 2026

Copy link
Copy Markdown

Thanks for the follow-up, @Fryuni. This addresses the explicit-dismissal issue from the previous review.

Overview

Summary

Clearing touch in cancel() (apps/web/src/lib/selectionActions.ts:80) prevents both scroll restoration and later selection-change notifications from reviving Cite after Escape. Touch pointercancel still preserves eligibility for an undismissed selection. The ADR now reflects that distinction.

I recommend merging this follow-up; no new blocking issues found in this push. I verified the code and test assertions, but did not execute the tests.

Good points

🟢 The regression test establishes an initial selection callback before checking that Escape, scrolling, and another selection-change notification produce no further callback, with timers advanced to flush scheduled work (apps/web/src/lib/selectionActions.browser.test.ts:49–60).

Main Issues

None identified in this follow-up.

@Fryuni
Fryuni merged commit d88ddb2 into main Oct 27, 2026
9 checks passed
@Fryuni
Fryuni deleted the fryuni/fix-mobile-text-selection-cite branch October 27, 2026 00:56
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.

1 participant