Repository navigation
Android: a TextInput with its context menu hidden opens no right-click menu - #59136
Open
YevheniiKotyrlo wants to merge 1 commit into
Open
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
…k menu A mouse right-click on an Android TextInput opens the context menu that Editor fills with Cut, Copy, Paste, Select all and the other text actions. ReactEditText honours contextMenuHidden only in its action mode callback, so a right-click still opened that menu with the flag set. ReactEditText adds no items to its context menu while contextMenuHidden is set, and the platform opens no menu without items: not on a right-click, and not from anything else that asks the view for its context menu.
YevheniiKotyrlo
marked this pull request as ready for review
October 16, 2026 11:31
Contributor
Author
Device evidence — before / afterUNFIXED — A right-click on the field with FIXED — It opens nothing and leaves the caret where it was; the field without the flag still opens its menu.
RedMagic NX809J, Android 16 (API 36): RNTester debug builds of |
This branch has not been deployed
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.


Summary:
On Android, a mouse right-click on a
TextInputwithcontextMenuHiddenstill opens the text context menu, with Cut, Copy, Paste, Select all and the other text actions.ReactEditTexthonours the flag only in its action mode callback, and a right-click starts no action mode:Viewasks the window for a context menu, andTextViewfills it throughEditor.onCreateContextMenu.ReactEditTextnow adds no items to its context menu whilecontextMenuHiddenis set, and the platform opens no menu without items, whatever asked for it.Editormoves the caret to the clicked position only while it fills that menu, so with the flag a right-click also leaves the caret where it was. A field without the flag keeps its menu. The mouse case was reported in #45355, which was closed as stale.Changelog:
[ANDROID] [FIXED] - A
TextInputwithcontextMenuHiddenno longer opens the context menu on a mouse right-clickTest Plan:
New
ReactTextInputPropertyTest.testContextMenuHiddenRightClick: with the field attached to an Activity,showContextMenu(x, y), which a right-click calls, opens a menu by default and opens none withcontextMenuHidden. Onmainit fails at the second assertion.RNTester's Playground (
RNTesterPlayground.js) with this component:Playground
Right-click each field with a mouse. On
mainboth open the context menu and move the caret to the click. With this change the first opens nothing and keeps its caret where it was, whether it is focused or not, and the second still opens its menu and moves its caret. I checked it on RNTester debug builds ofmainand this branch on an Android 16 phone, with the mouse driven through auinputvirtual device; the captures and readings are in this comment../gradlew :packages:react-native:ReactAndroid:testDebugUnitTest -PenableWarningsAsErrors=truepasses (757 tests), andnode ./scripts/format-kotlin.js --checkis clean.