Repository navigation
fix(mobile): hold-to-dictate, repeat keys and the browser long-press survive the page's long-press - #24277
Conversation
react-native-web ends a Pressable's press on a touch contextmenu unless it declares onLongPress, and Android WebView sends one ~500 ms into a hold, so the mic's press-out stopped the recording and the unprevented default began a text selection. Both hold-mode mics now declare a no-op onLongPress. The chat mic also swaps its icon on press; as the touch target, the removed icon received touchend detached from the document, so the release was lost. The icons opt out of pointer events so the Pressable is the target. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… WebView On an Android emulator the hold still ended ~500 ms in with onLongPress in place: the WebView's long-press starts a text selection, whose selectionchange react-native-web treats as a termination, and then sends touchcancel even when contextmenu is prevented. Cancelling touchstart on the hold-mode mic stops the WebView generating the long-press gesture at all. React's touch listeners are passive, so a platform seam attaches a native non-passive listener on the page; natively it is a no-op. The onLongPress no-op is removed: with no gesture there is no contextmenu to refuse. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…override The guard now names the three device facts that make onLongPress insufficient, arms through a testable holdTouchesOn, and is covered for element scoping, re-arming when the mode flips without a remount, and removal on unmount. The .web.ts sibling is listed in web-overrides.json. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…n the page The key bar's repeatable keys (Backspace, Del, arrows) and the browser pane's 550 ms long-press right-click are held touches, and Android WebView's ~500 ms long-press ends them the same way it ended hold-to-dictate. Both now take the hold-press guard: built-in keys move to MobileTerminalAccessoryKey so each has its own ref (react-native-web's merged refs drop React 19 ref cleanups, so one shared callback ref cannot arm several keys), and only repeatable keys arm it, since cancelling touchstart also drops a tap key's click. The pane's viewport arms it only while no browser dialog is open, because the dialog's buttons sit inside the viewport and need their click. The held-press rig now covers the mic, the keys and the pane, playing the WebView's long-press whenever an element left touchstart uncancelled. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…viewport The content the previous commit's message describes; that commit carried only the rig's file renames. Repeatable built-in keys move to MobileTerminalAccessoryKey so each owns its ref and arms the guard; tap keys keep their click. The browser viewport arms it while no dialog is open. The held-press rig gains the key-bar and browser-pane probes and plays the WebView's long-press whenever touchstart went uncancelled. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…e root A device trace showed the WebView sends no touchcancel on a long-press when no text selection starts, so the touchstart guard is not needed and its cost (a key-bar scroll could not start on a repeat key) goes with it. The seam, its test, its override entry and the per-key component are removed. Held presses (both mics in hold mode, the six repeatable keys) declare a shared no-op onLongPress, so react-native-web refuses the long-press contextmenu's termination. The page's native-parity style makes #root unselectable with no touch callout, as native text is unless it opts in; <Text selectable> still sets user-select: text. The browser pane's responder refuses termination by contextmenu, so its 550 ms right-click outlives the WebView's own long-press. The chat mic icons keep pointerEvents="none". The held-press rig mounts the real command dock and plays the WebView's long-press, with the selection and cancel only where text is selectable. The parity and rich-markdown rigs prove plain text no longer selects, selectable text and TextInput still do, and the editor edits and selects. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…d one The page-wide native-parity selection rule lands from the iOS lane in the next commit, unchanged, so both branches carry the identical rule. This removes the #root variant and its parity case first so that pick applies cleanly. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ative react-native-web leaves every Text selectable, where native RN Text is not. In the iOS shell a hold on plain text then raises WebKit's selection callout (Copy, Look Up, Translate) over the page's own long-press action sheet once WebKit text interaction is on. Body is user-select: none; inputs, textareas and contenteditable stay selectable, and `selectable` Text keeps its own rule. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…wn gestures On top of the shared rule: a double-click selects nothing in plain Text, selects in `<Text selectable>` (react-native-web's Text/index.js:115) and in a TextInput; a long-press of a tap key plays no selection and selects nothing; the held presses survive because no selection starts. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…he body scope Fields now also reset -webkit-touch-callout to default: WebKit inherits it, and an inherited none is the known cause of a missing Paste callout in iOS fields. The rule stays on body rather than #root because react-native-web's Modal portals to document.body; the parity rig now mounts a modal and shows its text unselectable and its field selectable in Chromium and WebKit. The WHY above the constant says both, the shared onLongPress no-op names both halves of the contract, and the probe routes drop the deleted guard. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe mobile web parity style now disables text selection and touch callouts across the body, with editable elements opting back in. Hold-mode microphones, repeatable command keys, and browser context-menu interactions have updated long-press handling. New render tests cover selection behavior, dictation holds, repeating keys, and browser-pane holds. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No concrete merge-blocking issue is identified. The selection exceptions and hold/release behavior have targeted render coverage; merge after normal checks pass. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The reviewed changes preserve existing release handlers and do not demonstrate a new public route or increased privileges. Remaining uncertainty concerns interruption races and the underlying recording and repeat-input cleanup. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the mobile OTA page's held presses (hold-to-dictate, repeatable dock keys) and the browser pane's long-press right-click, plus the page-wide selection rule and the render-test coverage.
- Hold presses through
onLongPress— a shared no-op (mobile/src/session/held-press-long-press.ts) is wired onto both hold-mode mics and the repeatable dock keys, which is RNW's own switch for refusingcontextmenutermination. MatchesPressResponder'sonResponderTerminationRequest/onContextMenugating (onLongPress != null && _isPointerTouch). - Page text unselectable unless marked selectable —
bodygetsuser-select:none+ no touch callout and fields opt back in, so no selection is raised under the finger and the WebView sends noselectionchange/touchcancel.bodyscope (not#root) correctly covers RNW Modals. - Chat mic release —
pointerEvents="none"on the swapped icons keeps the press target on the Pressable, so the release reachesonPressOut. - Browser pane —
onPanResponderTerminationRequestnow refusescontextmenu, letting the 550 ms right-click timer outlive the ~500 ms WebView long-press. - Tests — new held-press render suite plus native-parity and rich-markdown cases; specialists confirmed the mic/repeat/browser assertions fail against the pre-fix code. The
mobile_web_appCI job is green onee0979b, so these run for real.
Two notes, neither requiring action here: test / tests node 24 2/5 is red on an unrelated unhandled AgentSessionJournalError in src/main/native-chat/agent-session-journal/journal-per-session-import.test.ts (the verify job only fails because it gates on it), and the field callout exemption implies -webkit-touch-callout inheritance matters for selectable <Text> too — not observable in desktop WebKit, and the iOS device result in the description covers it.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…s toast The probe's stub client records requests; a 1 s hold sends one right mouseClick and its release none, and a tap sends one left click and no toast. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since Pullfrog's prior review at ee0979b, a test-only strengthening of the browser pane probe.
- Browser probe records host requests — the stub
clientnow records everysendRequest(method + params) andpageParamsreturns real values, so the pane'ssendPointerClickactually runs instead of short-circuiting on a null client; the "Right click" toast is no longer the only witness. - Right-click test asserts the host call — it now checks the recorded
browser.mouseClickwith{ button: 'right', page: 'held-press-page' }mid-hold and confirms the release sends no left click. - New tap regression test — a plain
tap()on the viewport must yield exactly one{ button: 'left' }click and no toast, guarding theonPanResponderTerminationRequestchange against swallowing ordinary taps.
The assertions are exact and read the request where the host would see it, so the new coverage is real rather than toast-deep.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

What
On the OTA page, holding the mic in hold-to-dictate mode stopped recording about half a second in and sometimes selected nearby text (the "Model" chip). The same thing killed the terminal's repeat keys (Backspace, Del, the arrows) and the browser pane's long-press right-click. Native is unaffected.
Cause, traced on the Android WebView. A held touch becomes the WebView's long-press:
selectstart→contextmenu→selectionchange→touchcancel. react-native-web ends a press onselectionchangeand ontouchcancel, and refuses only thecontextmenuleg, and only when the Pressable declaresonLongPress. Our hold surfaces declared none. The selection is what drives the cancel: with no selectable text under the finger, the WebView sends notouchcancelat all (measured; see the trace in the lane's proof).Fix, two halves that only work together.
Textis unselectable by default; react-native-web's is not. One rule in the page's native-parity style:bodygetsuser-select: noneand no touch callout; inputs, textareas and the editor stay selectable and keep their callout;<Text selectable>(chat, markdown, diff rows, file preview) opts back in through react-native-web's ownuser-select: text. This also closes the audit's finding that every button and chip label on the page could be selected on long press.onLongPress. One shared no-op,keepHeldPressThroughLongPress, on both mics in hold mode and the six repeatable keys. That is the library's own switch for "this control owns the long press"; with no selection in play it is sufficient. Nothing changes natively (onPressis undefined in hold mode; the repeat keys act on press-in).Two independent fixes ride along:
pointerEvents="none"so the button is the target.contextmenu(a no-op natively), so the 550 ms right-click outlives the 500 ms long-press.No new module, no seam, no dependency. The same page rule is a prerequisite for the iOS shell fix in #24270, which must land after this.
Tests (red first)
expected 1 to be greater than 20), long-press on Esc selects nothing, the browser pane right-clicks on a 1 s hold (red:toasts: []).<Text selectable>and TextInput select (red:expected 'label' to be ''andexpected '\n' to be '').Device (Pixel_API_37 emulator, OTA shell from main, page from this branch)
iOS (iPhone 17 Pro simulator, OTA shell with #24270, page built with this rule): long-press in the composer shows the Paste / Select / AutoFill menu; the Model chip opens its picker and the Esc key selects nothing; a chat message selects with the Copy / Look Up / Translate menu; a 600 ms hold on a worktree row opens its sheet with no callout; the terminal mic hold runs to release. The chat mic's release bug reproduced there without this branch's icon fix. The rich editor was not driven on a device (the headless runtime cannot open a Markdown Note); the WebKit rig covers it.