Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[BUG] After increasing Popup height any elements outside of original bounds do not receive touches on iOS

Open primozcerar opened this issue 1 year ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

  • [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

Current Behavior

After increasing Popup height any elements outside of original bounds do not receive touches.

Expected Behavior

Touches should be received by any element on the popup even after increasing it's size

Steps To Reproduce

  1. Create a Popup with some resizable layout and a button
  2. Increase the size of the Popup content so that the button stay on the bottom
  3. On iOS it is now impossible to press the button (tested on iOS simulator "iPhone 15 iOS 17" and "iPhone 14 iOS 16"

Link to public reproduction project repository

https://github.com/cat0363/MauiComm-IssuePopupGesture

Environment

- .NET MAUI CommunityToolkit: 6.1.0, same behaviour on 5.0.0
- OS: iOS 17
- .NET MAUI: 7.0.96/7.0.100

Anything else?

No response

primozcerar avatar Nov 15 '23 13:11 primozcerar

Hi @primozcerar. We have added the "needs reproduction" label to this issue, which indicates that we cannot take further action. This issue will be closed automatically in 5 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Nov 15 '23 13:11 ghost

@bijington I'm sorry I can not currently create a reproduction repo as I am working on a project with an extremely tight deadline. I will get back to it when I can if you can't reproduce it. This is however a serious issue for me right now and I might have to temporarily drop iOS support because of it as I have found no workaround and redesigning the Popup or splitting it into multiple popups would take too much time and look unprofessional.

primozcerar avatar Nov 15 '23 13:11 primozcerar

I have just found a workaround that might help with solving this issue or help anyone stuck on this. It is resolved by measuring the Popup.Content size and then assigning it to the content.parent element.

(Dialog.Content!.Parent as VisualElement)!.HeightRequest = measuredSize.Height;

primozcerar avatar Nov 15 '23 14:11 primozcerar

Although not Popup, I have experienced a problem similar to this on the .NET MAUI side. I remember implementing workarounds like the one you described.

cat0363 avatar Nov 16 '23 00:11 cat0363

@primozcerar , @bijington , I don't know if this is the same issue, but I reproduced it below.

<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
    x:Class="MauiComm_IssuePopupGesture.PopupPage1"
    Size="200,200" HorizontalOptions="Center" VerticalOptions="Center">
    <Grid x:Name="gdTest" RowDefinitions="*,44,44,44" SizeChanged="gdTest_SizeChanged" VerticalOptions="Start" HeightRequest="200">
        <Label Grid.Row="0" Text="This is gesture test." />
        <Label Grid.Row="1" x:Name="lblTapTimes" Text="Tap Times : 0" />
        <Button Grid.Row="2" x:Name="btnChangeSize" Text="Size Change" Clicked="btnChangeSize_Clicked" />
        <Button Grid.Row="3" x:Name="btnClick" Text="Click" Clicked="btnClick_Clicked" />
    </Grid>
</toolkit:Popup>

void btnChangeSize_Clicked(object sender, EventArgs e)
{
    gdTest.HeightRequest = 250;
}

void btnClick_Clicked(object sender, EventArgs e)
{
    lblTapTimes.Text = "Tap Times : " + (++tapTimes);
}

void gdTest_SizeChanged(object sender, EventArgs e)
{
    Size = new Size(Size.Width, gdTest.Height);
    // (Content!.Parent as VisualElement)!.HeightRequest = gdTest.Height;  // <= workaround code
}

Below is the verification video.

https://github.com/CommunityToolkit/Maui/assets/125236133/a665f531-8dc1-4351-b9b6-4ee8a5603e21

Uncommenting the workaround code works as intended.

https://github.com/CommunityToolkit/Maui/assets/125236133/24787e34-53b3-4f0f-9588-4c1b78a0d443

If the problem is the same, it is possible to upload the reproduction code.

cat0363 avatar Nov 16 '23 06:11 cat0363

@cat0363 Thank you very much. That is exactly the issue I am facing.

primozcerar avatar Nov 16 '23 07:11 primozcerar

@primozcerar , Thank you for confirmation.

I have uploaded the reproduction code below. https://github.com/cat0363/MauiComm-IssuePopupGesture.git

cat0363 avatar Nov 16 '23 08:11 cat0363

I am running into an issue where the gesture recognizer attached to a Border within a Popup isn't being hit upon a tap/click. This is also on iOS. Here is a reproducer I pushed to GH. Should I open a separate issue, or is this caused by the same bug? This isn't a MAUI bug it seems - when using the same controls inside a ContentPage instead of a Popup, not able to repro.

williambohrmann3 avatar Dec 22 '23 22:12 williambohrmann3