Skip to content

Commit

Permalink
chore: Fix first responder on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Sep 17, 2021
1 parent a444b7a commit ae05fa3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Controls/Page/Page.mux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private protected override void OnLoaded()
this.SetFocusedElement(
this,
FocusState.Programmatic,
false /*animateIfBringIntoView*/);
animateIfBringIntoView: false);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/Input/FocusManager.macOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public partial class FocusManager
{
private static void FocusNative(UIElement control)
{
if (control?.CanBecomeFirstResponder == true)
if (control?.AcceptsFirstResponder() == true)
{
control.BecomeFirstResponder();
Window.Current?.NativeWindow?.MakeFirstResponder(control);
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions src/Uno.UI/UI/Xaml/Window.macOS.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using CoreGraphics;
using Foundation;
using System;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using AppKit;
using CoreGraphics;
using Foundation;
using Uno.UI;
using Uno.UI.Controls;
using Uno.UI.Xaml.Core;
using Windows.Foundation;
using Windows.Foundation.Metadata;
using Windows.UI.Core;
using Uno.UI.Controls;
using System.Drawing;
using Windows.UI.ViewManagement;
using Uno.UI;
using Windows.UI.Xaml.Controls;
using Uno.UI.Xaml.Core;

namespace Windows.UI.Xaml
{
Expand Down Expand Up @@ -62,6 +62,8 @@ public Window()
InitializeCommon();
}

internal NSWindow NativeWindow => _window;

private void ObserveOrientationAndSize()
{
_windowResizeNotificationObject = NSNotificationCenter.DefaultCenter.AddObserver(
Expand Down

0 comments on commit ae05fa3

Please sign in to comment.