Skip to content

Commit

Permalink
2174059 MAUI hit testing ignores pages loaded by PushModalAsync (#24109)
Browse files Browse the repository at this point in the history
* MAUI hit testing ignores pages loaded by PushModalAsync

Updated VisualTreeElementExtension to get the MauiWinUiWindow Element, as its content member gets modal content in addition to underlying content

* PR Feedback

Update the code to use the UI.Xaml.Window instead of the MauiWinUIWindow
  • Loading branch information
lizharems authored Aug 21, 2024
1 parent af2b668 commit 937f410
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Core/src/Core/Extensions/VisualTreeElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ static List<IVisualTreeElement> GetVisualTreeElementsWindowsInternal(IVisualTree
var visualElements = new List<IVisualTreeElement>();
if (visualElement is IWindow window)
{
uiElement = window.Content?.ToPlatform();
// Get the UI.Xaml.Window so we catch everything in the app window rather than the frame which doesn't include modal content
var platformView = window.Handler?.PlatformView;
if (platformView is UI.Xaml.Window winUiWindow)
{
uiElement = winUiWindow.Content;
}
}
else if (visualElement is IView view)
{
Expand Down

0 comments on commit 937f410

Please sign in to comment.