MacOS - Fix crash when invoking VisualElement.Focus() (#12267)
NSInternalInconsistencyException: NSWindow: -_oldFirstResponderBeforeBecoming is not a valid message outside of a responder's implementation of -becomeFirstResponder. https://developer.apple.com/documentation/appkit/nsresponder/1526750-becomefirstresponder?language=objc https://developer.apple.com/documentation/appkit/nsresponder/1532115-resignfirstresponder?language=objc Use the NSWindow makeFirstResponder: method, not this method, to make an object the first responder. Never invoke this method directly.
This commit is contained in:
Родитель
0be2136844
Коммит
10f1043762
|
@ -305,8 +305,12 @@ namespace Xamarin.Forms.Platform.MacOS
|
|||
{
|
||||
if (Control == null)
|
||||
return;
|
||||
|
||||
|
||||
#if __MOBILE__
|
||||
focusRequestArgs.Result = focusRequestArgs.Focus ? Control.BecomeFirstResponder() : Control.ResignFirstResponder();
|
||||
#else
|
||||
focusRequestArgs.Result = focusRequestArgs.Focus ? Control.Window.MakeFirstResponder(Control) : Control.Window.MakeFirstResponder(null);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче