Fix TextInput focus when inside a FocusZone #3849
Merged
+41
−2
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.
Platforms Impacted
Description of changes
When a TextInput is not inside a FocusZone, it properly participates in the key view loop in that Tab\Shift+Tab will place focus on the inner
RCTUITextView
, instead of the outerRCTBaseTextInputView
subclass. This is due to overriding thecanBecomeKeyView
in that base class.However, the FocusZone control does not look at that property -- instead it only considers
canBecomeFirstResponder
, as seen in #2329. Although it seems like the logical next step to usecanBecomeKeyView
in the FocusZone, that was previously done with #2267 but later reverted in #2322 since it broke things downstream. Instead, we'll make a compromise and leak some of the text input implementation details into the focus zone -- if we're considering focusing a subclass ofRCTBaseTextInputView
, we'll instead use the containingbackedTextInputView
.Verification
Testing:
Notes:
Pull request checklist
This PR has considered (when applicable):