-
Notifications
You must be signed in to change notification settings - Fork 1.2k
keyboardtype parity to paper in fabric #15359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
keyboardtype parity to paper in fabric #15359
Conversation
6b080f9 to
882dede
Compare
| HCURSOR m_hcursor{nullptr}; | ||
| std::chrono::steady_clock::time_point m_lastClickTime{}; | ||
| std::vector<facebook::react::CompWindowsTextInputSubmitKeyEventsStruct> m_submitKeyEvents; | ||
| std::string m_keyboardType{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not be storing copies of props on the component. The value already exists in the prop object, lets not duplicate memory.
acoates-ms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR does nothing. It just duplicates the prop storage, and doesn't implement the functionality of this prop.
Yes, it is not complete and I was just trying to explore but windowless RichEdit controls do not support InputScope. This feature requires XAML controls (Paper architecture) or a future Windows platform API that supports windowless input scope hints. |
|
Can't use TSF by using InputScope APIs (ITfContextOwner, ITfInputScope) but require a window handle (HWND), but Fabric is windowless. |
- Implement SetInputScopes on parent HWND when TextInput gains focus - Reset InputScope to default when TextInput loses focus - Map all React Native keyboardTypes to Windows InputScope values - Add KeyboardTypeTest.tsx sample for testing - Add implementation documentation Note: API calls succeed but Windows desktop Touch Keyboard may not respond to InputScope changes. This is a known Windows platform limitation that also affects web browsers. Works on Windows tablets.
571882b to
c1d0caf
Compare
…flow - Add LogToFile() function that writes to keyboard_debug.log in the exe directory - Add logging in onGotFocus and updateKeyboardType to trace keyboard type flow - Fix touch identifier overflow by normalizing pointer ID with modulo 21 - This helps debug why touch keyboard layout may not change on touchscreen devices
- Implement ITfInputScope interface on CompTextHost for TSF integration - TSF (Text Services Framework) can now query InputScope directly - Add GetCurrentInputScope() method to WindowsTextInputComponentView - Store current InputScope in m_currentInputScope member - Add logging when ITfInputScope::GetInputScopes is called - This enables Touch Keyboard to show appropriate layout based on keyboardType
- Log when we successfully query ITfInputScope from m_textHost - This verifies our ITfInputScope implementation is properly exposed - Helps diagnose why TSF/Touch Keyboard doesn't query our InputScope
- Create ITfThreadMgr to understand TSF state - Query GetFocus to see if there's a focused document - Query GetTop to get the active context - This helps diagnose if TSF is properly integrated with our control
Since windowless RichEdit doesn't register with TSF (GetFocus returns no document), we create a hidden EDIT control that: 1. Has the correct InputScope set on it 2. Gets Windows focus when our TextInput gets focus 3. Forwards keyboard input to our RichEdit via subclassing 4. Touch Keyboard queries this EDIT and shows the correct layout This works around the limitation that SetInputScopes on parent HWND has no effect when there's no TSF DocumentMgr associated with it.
…extInput - Use WS_EX_TRANSPARENT | WS_EX_LAYERED with 0 alpha for invisibility - Use WS_VISIBLE flag which is required for proper TSF integration - Position proxy EDIT at the TextInput location instead of off-screen - Add TSF check after SetFocus to verify document manager registration
|
@acoates-ms I tried few ways to do the keyboard parity work for windowless, please see this video, the whole keyboard still remains same but with different options. Is this fine? keyboardTypeTest.mp4 |
…github.com/Nitin-100/react-native-windows into nitin/parity-fabric/textinput-keyboardtype
Description
Type of Change
Why
The
keyboardTypeprop is a standard React Native TextInput property that allows developers to specify which keyboard type to display (e.g., numeric, email, phone pad). This prop was already defined and parsed in Fabric's WindowsTextInputProps but was not being applied to the native component, creating a parity gap with Paper (XAML) implementation where it is fully functional.Current Status:
This change is part of the ongoing effort to achieve feature parity between Paper and Fabric architectures for TextInput components.
What
This PR implements proper handling of the
keyboardTypeprop in Fabric's TextInput component:Files Modified:
WindowsTextInputComponentView.h
updateKeyboardType()method declarationm_keyboardTypemember variable to store the keyboard typeWindowsTextInputComponentView.cpp
updateKeyboardType()method to store the keyboard type valueupdateProps()to detect prop changesonMounted()for initial setupImplementation Approach:
Since Fabric uses windowless RichEdit controls with TextServices (not XAML controls), and
Windows.UI.Xaml.Input.InputScopeis not available in Composition architecture, this implementation stores the keyboard type value to maintain the prop contract. The keyboard behavior is primarily handled by the system's Input Method Editor (IME).Supported Keyboard Types:
default,numeric,number-pad,decimal-pad,email-address,phone-pad,urlweb-searchsecureTextEntryis enabledScreenshots
keyboardtype.mp4
Verify that:
updateKeyboardType()Changelog
Should this change be included in the release notes: Yes
Summary for release notes:
Added support for
keyboardTypeprop in Fabric TextInput to achieve parity with Paper implementation. This standard React Native prop now properly handles keyboard type specification (numeric, email, phone, etc.) in Fabric architecture.Microsoft Reviewers: Open in CodeFlow