Repository navigation
fix(android): a long-press drag selection is no longer stolen by a scrolling parent - #6
Merged
juliusmarminge merged 1 commit intoOct 16, 2026
Conversation
…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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
EditorcallsrequestDisallowInterceptTouchEvent(true)on the parents and relies on it untilACTION_UP.reallowParentInterceptIfLinkReleased()runs after every non-ACTION_DOWNevent and callsrequestDisallowInterceptTouchEvent(false)whenever no link is pressed. That undoes theEditor's request on the nextACTION_MOVE.ACTION_CANCEL, and the selection action mode never starts.Fix:
LinkLongPressMovementMethod.disallowsParentInterceptrecords whencancelJSTouchForLinkTap()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-mobilewithout conflicts. It can be dropped when the fork syncs past the upstream merge. It touches the same React NativeLinkLongPressMovementMethod.ktas the link long-press fork PR; the two merge cleanly together.Testing
Editordrag path, and upstream's React Native package had no test setup when I wrote it.ACTION_UPwithhasSelection() == trueand noACTION_CANCELmid-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.