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 Dec 17, 2024
1 parent 8f198f9 commit 032cdcb
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 032cdcb

Please sign in to comment.