Skip to content

Commit

Permalink
fix: Avoid FocusManager usage before WASM fully initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Dec 21, 2021
1 parent 973afb6 commit cb0dfc8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Uno.UI/UI/Xaml/Input/FocusManager.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ public static void ReceiveFocusNative(int handle)
{
// This might occur if a non-Uno element receives focus
var focusManager = VisualTree.GetFocusManagerForElement(Window.Current.RootElement);
focusManager.ClearFocus();

// The focus manager may be null if JS raises focusin/blur before the app is initialized.
focusManager?.ClearFocus();
}
}

Expand Down

0 comments on commit cb0dfc8

Please sign in to comment.