-
Notifications
You must be signed in to change notification settings - Fork 138
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
Prevent spurious onBlur/onEndEditing events in <TextInput>
elements with placeholder text
#2160
Prevent spurious onBlur/onEndEditing events in <TextInput>
elements with placeholder text
#2160
Conversation
Since this is touching iOS code too, could we check if the problem reproes on iOS, and whether it can be usptreamed? If not, could we limit to macOS only blocks via ifdefs? I'm not sure we need to do that but it helps a little in merges. |
This doesn't repro on iOS because editing |
… with placeholder text (microsoft#2160) * Add _isUpdatingPlaceholderText to prevent spurious "did end editing" notifications * Organize macOS tags and ifdef blocks --------- Co-authored-by: Adam Gleitman <[email protected]>
… with placeholder text (microsoft#2160) * Add _isUpdatingPlaceholderText to prevent spurious "did end editing" notifications * Organize macOS tags and ifdef blocks --------- Co-authored-by: Adam Gleitman <[email protected]>
) * Deduplicate `textInputDid(Begin|End)Editing` calls for multiline `<TextInput>` elements (#2159) * Add _isCurrentlyEditing to RCTBaseTextInputView * Move _isCurrentlyEditing check earlier in textInputDidBeginEditing * Adjust comment * nit: remove extra newline * Limit changes to macOS --------- Co-authored-by: Adam Gleitman <[email protected]> * Prevent spurious onBlur/onEndEditing events in `<TextInput>` elements with placeholder text (#2160) * Add _isUpdatingPlaceholderText to prevent spurious "did end editing" notifications * Organize macOS tags and ifdef blocks --------- Co-authored-by: Adam Gleitman <[email protected]> --------- Co-authored-by: Adam Gleitman <[email protected]>
) * Deduplicate `textInputDid(Begin|End)Editing` calls for multiline `<TextInput>` elements (#2159) * Add _isCurrentlyEditing to RCTBaseTextInputView * Move _isCurrentlyEditing check earlier in textInputDidBeginEditing * Adjust comment * nit: remove extra newline * Limit changes to macOS --------- Co-authored-by: Adam Gleitman <[email protected]> * Prevent spurious onBlur/onEndEditing events in `<TextInput>` elements with placeholder text (#2160) * Add _isUpdatingPlaceholderText to prevent spurious "did end editing" notifications * Organize macOS tags and ifdef blocks --------- Co-authored-by: Adam Gleitman <[email protected]> --------- Co-authored-by: Adam Gleitman <[email protected]>
Summary:
While working on #2159, I noticed that a single-line
<TextInput>
with a placeholder causes spuriousonBlur
andonEndEditing
events. For some strange reason, settingplaceholderAttributedString
on macOS causes theNSTextDelegate
to calltextDidEndEditing
. This PR blocks these events from reaching the JS side.Test Plan:
Validated in RNTester that
onBlur
andonEndEditing
don't get called unexpectedly when dealing with a<TextInput>
with placeholder text.