fix(textinput): show touch keyboard on focus and on tap (windowless island; re-tap reopens)#16330
Open
FaithfulAudio wants to merge 1 commit into
Open
Conversation
Contributor
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
…terop for windowless island; re-tap reopens a dismissed keyboard)
FaithfulAudio
force-pushed
the
fix/textinput-touch-keyboard
branch
from
July 24, 2026 04:36
9d61725 to
6d5d4a0
Compare
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.
Fixes #16331.
Problem
On a Windows tablet with no physical keyboard, tapping a single-line
<TextInput>(e.g. a login field) never raises the touch keyboard. Additionally, after the keyboard is dismissed, re-tapping the (still-focused) field does not bring it back.Root cause
Fabric/Composition
TextInput(WindowsTextInputComponentView) has no code that requests the touch keyboard on focus —onGotFocusnever touchesInputPane/CoreInputView. In a WinAppSDK Win32 island app there is noCoreWindow, and the RichEdit is hosted windowless viaITextServices(no child edit HWND), so the OS's own touch-keyboard auto-invoke heuristic never fires either. Net: the keyboard never appears. (The UWP-era PR #2029 for this was closed and relied onGetForCurrentView()APIs that don't apply to the island model.)A tap on an already-focused field does not fire
onGotFocus, so a focus-only trigger can't re-raise a keyboard the user has dismissed.Fix
New helper
ShowSoftKeyboard()requests the touch keyboard viaInputPane, obtained through the Win32 interopIInputPaneInterop::GetForWindow()keyed off the island's top-level AppWindow HWND (rootComponentView()->GetHwndForParenting()). Gated on slate/tablet posture (SM_CONVERTIBLESLATEMODE == 0) so it does not pop on a laptop/convertible with a keyboard attached; wrapped intry/catchso it can never break input handling.It is called from both:
onGotFocus— raise the keyboard when the field gains focus, andOnPointerPressed— raise it on tap, so re-tapping an already-focused field reopens a dismissed keyboard.Focus is intentionally left untouched on keyboard dismissal (the field stays focused; the user reopens the keyboard by tapping it again — the platform-appropriate behavior here).
Uses
IInputPaneInteropfrom<inputpaneinterop.h>andwinrt::Windows::UI::ViewManagement::InputPane— both ship in the Windows SDK already referenced by Microsoft.ReactNative, so there are no.vcxproj/reference changes.Validation
Compiled into Microsoft.ReactNative from source (yarn-patch framework build,
UseExperimentalNuget=false) in a production RNW 0.83.2 new-arch app (Facilitron FIT), x64 Release, deployed to a physical x64 tablet. With the keyboard detached (Windows suppresses the touch keyboard while a hardware keyboard is attached):All three confirmed on-device. Remaining for upstream: CI build across archs.
Caveats for reviewers
0.83-stableto match our production app; happy to re-cut ontomain.SM_CONVERTIBLESLATEMODE(non-convertible desktops report slate/0). Open to a different signal (e.g.UserInteractionMode/touch-initiated focus) if preferred.