Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[fabric] Make text input first responder through the window instance
Summary:
Fix AppKit exception throws when focusing text inputs by calling becomeFirstResponder directly on the backing text input view.

Making a view first responder has to happen through the window using makeFirstResponder.

Test Plan:
- Run Zeratul with Fabric
- Focus the search text input above the message threads
- Click inside the active message thread to trigger the auto-focus of the composer
- The composer gets focus without AppKit throwing an exception.

 https://pxl.cl/3dVMx

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D48696690
  • Loading branch information
Nick Lefever authored and Saadnajmi committed Nov 20, 2024
commit 81527c131a382bf0407a9746d019d9842150a8ef
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,14 @@ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args

- (void)focus
{
#if !TARGET_OS_OSX // [macOS]
[_backedTextInputView becomeFirstResponder];
#else // [macOS
NSWindow *window = _backedTextInputView.window;
if (window) {
[window makeFirstResponder:_backedTextInputView];
}
#endif // macOS]

const auto &props = static_cast<const TextInputProps &>(*_props);

Expand Down