Skip to content

Commit

Permalink
[macOS] Prevent popups from stealing focus (#17794)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJul authored and maxkatz6 committed Dec 19, 2024
1 parent f29675d commit aa9ce85
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions native/Avalonia.Native/src/OSX/PopupImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ virtual HRESULT Show(bool activate, bool isDialog) override

return WindowBaseImpl::Show(activate, true);
}

virtual bool ShouldTakeFocusOnShow() override
{
// Don't steal the focus from another windows if our parent is inactive
if (Parent != nullptr && Parent->Window != nullptr && ![Parent->Window isKeyWindow])
return false;

return WindowBaseImpl::ShouldTakeFocusOnShow();
}
};


Expand Down

0 comments on commit aa9ce85

Please sign in to comment.