Repository navigation
fix(android): a long-press drag selection is no longer stolen by a scrolling parent - #1012
Merged
hryhoriiK97 merged 3 commits intoOct 18, 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.
voida6
force-pushed
the
fix/android-selection-drag-parent-intercept
branch
from
October 16, 2026 03:44
cf41163 to
1d38a0b
Compare
1 of 6 tasks
Contributor
Author
|
Hi @hryhoriiK97, thanks for merging #1011! Could you also approve the CI workflow runs for this one? They are still waiting for approval because the PR comes from a fork. |
…Method Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Thanks for tracking this down! I reproduced it on an Android emulator: on main, a long-press drag inside a ScrollView was cut off with no handles or toolbar, and with your fix it worked. I pushed a small refactor on top that keeps the same behavior but moves the parent-intercept handling into one place:
I re-tested on the emulator: long-press drag selection (down and sideways), scrolling, link taps and drags starting on links, table scrolling, and the #475 case (links inside an RNGH |
hryhoriiK97
approved these changes
Oct 18, 2026
…ent method Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Thanks! |
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, extending a text selection by long-pressing a word and dragging often goes wrong when the text sits inside a scrolling parent (a ScrollView or a FlatList of messages). The magnifier shows and the selection grows, then the gesture is cut off: on finger-up there are no selection handles and no selection toolbar, and the selection collapses or needs an extra tap before Copy shows. Double-tapping a word works, because nothing moves.
Cause:
EditorcallsrequestDisallowInterceptTouchEvent(true)on the TextView's parents and relies on that untilACTION_UP.reallowParentInterceptIfLinkReleased()(added in fix(android): prevent RNGH Pressable from stealing link tap gestures #477) runs after every non-ACTION_DOWNevent and callsrequestDisallowInterceptTouchEvent(false)whenever no link is pressed. So on the nextACTION_MOVEit undoes theEditor's request.ACTION_CANCEL, and theEditornever starts the selection action mode.The re-allow is only there to undo the request
cancelJSTouchForLinkTap()makes for a link press. This change records whencancelJSTouchForLinkTap()made that request (LinkLongPressMovementMethod.disallowsParentIntercept), andreallowParentInterceptIfLinkReleased()only undoes it in that case. Link presses behave as before: the request is made onACTION_DOWNover a link and released when the link touch ends or moves past the slop. For any other gesture the call was redundant anyway, since a ViewGroup clears the disallow flag itself on the nextACTION_DOWN. A normal swipe on text still scrolls the parent, because nothing requests disallow for it.Only
react-native-enriched-markdownhas this function;enriched-markdown-androiddoes not re-allow and is unchanged.Testing
Release build of an app on
react-native-enriched-markdown(T3 Code) with this patch, on a Galaxy S25 Ultra (Android 16, One UI). Assistant message text inside the app's scrolling message list, no links under the finger. Two sideways long-press drags, one downward long-press drag, then a double-tap. Touches are shown as white dots.ACTION_UPwithhasSelection() == truefor each of them and noACTION_CANCELmid-drag. Plain swipes on the same text still scrolled the list (they loggedACTION_CANCELwith no selection, as expected for a parent scroll). On the same build, a link tap, a 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
I did not add a unit test: the React Native package has no unit test setup, and the standalone Android package does not have this function.
ktlint1.8.0 (the version the build uses) passes on both changed files.PR Checklist
iOS is unchanged. I verified in a downstream app (T3 Code) instead of the example app, and did not run the Maestro suite. No docs change.