Skip to content

fix(android): a long-press drag selection is no longer stolen by a scrolling parent - #6

Merged
juliusmarminge merged 1 commit into
pingdotgg:fork/t3-mobilefrom
voida6:fork/android-selection-drag-parent-intercept
Oct 16, 2026
Merged

juliusmarminge merged 1 commit into
pingdotgg:fork/t3-mobilefrom
voida6:fork/android-selection-drag-parent-intercept

Conversation

@voida6

@voida6 voida6 commented Oct 16, 2026 •

Copy link
Copy Markdown

What/Why?

On Android, a long-press drag to extend a text selection in the T3 Code message list is often cut off. The magnifier shows and the selection grows, then on finger-up there are no handles and no toolbar. Double-tapping a word works.

Cause:

  1. When the finger moves during a long-press selection, the framework Editor calls requestDisallowInterceptTouchEvent(true) on the parents and relies on it until ACTION_UP.
  2. reallowParentInterceptIfLinkReleased() runs after every non-ACTION_DOWN event and calls requestDisallowInterceptTouchEvent(false) whenever no link is pressed. That undoes the Editor's request on the next ACTION_MOVE.
  3. The scrolling list intercepts the drag, the TextView gets ACTION_CANCEL, and the selection action mode never starts.

Fix: LinkLongPressMovementMethod.disallowsParentIntercept records when cancelJSTouchForLinkTap() made the request, and the re-allow only undoes that request. Link presses behave as before. A plain swipe on text still scrolls the list.

Upstream: software-mansion#1012 (open, unreviewed). This is the same commit, cherry-picked onto fork/t3-mobile without conflicts. It can be dropped when the fork syncs past the upstream merge. It touches the same React Native LinkLongPressMovementMethod.kt as the link long-press fork PR; the two merge cleanly together.

Testing

  • ktlint 1.8.0 passes on both changed files on this branch. No unit test: the function under test needs the framework Editor drag path, and upstream's React Native package had no test setup when I wrote it.
  • Device: release build of T3 Code with this patch on a Galaxy S25 Ultra (Android 16), assistant message text in the message list. Before: drags were cut off with no handles or toolbar. After: each of 4 long-press drags ended with handles and the Copy toolbar; a debug log recorded ACTION_UP with hasSelection() == true and no ACTION_CANCEL mid-drag. Plain swipes still scrolled the list. Link tap, link long-press and a long-press that slides off a link behaved as before.

Before:

before-drag-selection.mp4

After:

after-drag-selection.mp4

iOS is unchanged.

Credit: when this ships in a T3 Code bump, could the bump commit include Co-authored-by: voida6 <289179128+voida6@users.noreply.github.com>? Thanks.

…rolling parent

When the finger moves during a long-press text selection, the framework Editor
calls requestDisallowInterceptTouchEvent(true) on the TextView's parents and
keeps that until ACTION_UP. reallowParentInterceptIfLinkReleased() called
requestDisallowInterceptTouchEvent(false) on every non-DOWN event whenever no
link was pressed, which undid the Editor's request on the next move. A
scrolling parent then intercepted the drag, the TextView got ACTION_CANCEL, and
the selection ended without handles or the selection toolbar.

Track whether cancelJSTouchForLinkTap() made the request and only undo our own.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0166f198-631c-4753-9789-0ecb8f994082

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@juliusmarminge
juliusmarminge merged commit 79194e4 into pingdotgg:fork/t3-mobile Oct 16, 2026
2 checks passed
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.

2 participants