-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Fabric] Implement selectTextOnFocus prop in TextInput #14412
base: main
Are you sure you want to change the base?
Conversation
Can we maybe just map selectTextOnFocus to ES_SAVESEL? Not using onFocus means that we miss various other method of the textinput gaining focus. (Keyboarding, accessibility, programatic) |
@acoates-ms I agree we should take care of the other ways to focus, not just the left mouse button. However, I tried both ES_SAVESEL/ECO_SAVESEL and neither seem to do anything. |
Description
Type of Change
New feature.
Why
Implement selectTextOnFocus prop in TextInput. It is implemented in Paper; this PR brings the Fabric implementation.
Resolves #13133
What
Created a function that:
The function is called in two places:
OnPointerReleased()
, if the mouse left button was pressed, to select the text.OnLostFocus()
, to clear the selection.Text selection will not occur if
clearTextOnFocus
prop is set totrue
. This is purely by design, as the RN documentation doesn't specify what the behavior should be. For reference, if both props are set to true, Android doesn't clear the text on focus and performs the selection, but iOS clears the text input.Screenshots
selectTextOnFocus.mp4
Testing
Added e2e tests to TextInputComponentTest and two TextInput fields in playground, in both cases demonstrating the capabilities explained above.
Changelog
Yes
Implement selectTextOnFocus for TextInput in Fabric
Microsoft Reviewers: Open in CodeFlow