maui
maui copied to clipboard
Overlaying a StackLayout on another StackLayout does not block interaction
Description
I overlayed two Stack Layouts on top of each other using AbsoluteLayout and I was still able to interact with the button in the StackLayout . Is this expected because to my knowledge the second StackLayout should block interaction with the main StackLayout.
Steps to Reproduce
- Create a .net MAUI app
- Copy below code to the XAML file:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiApp2.MainPage">
<AbsoluteLayout>
<StackLayout AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0,0,1,1"
Margin="5">
<Button Text="Clic Me!" BackgroundColor="GreenYellow" Clicked="Button_Clicked"/>
</StackLayout>
<StackLayout AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0,0,1,1"
BackgroundColor="Gray"
Opacity="0.6">
</StackLayout>
</AbsoluteLayout>
</ContentPage>
- Copy below code in the code behind file:
namespace MauiApp2;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private void Button_Clicked(object sender, EventArgs e)
{
DisplayAlert("", "Hello World", "Cancel");
}
}
- Run the app
- Click the button (which is placed in the first StackLayout) and it will fire the alert; the second StackLayout should block interaction with the first one.
Link to public reproduction project repository
No link
Version with bug
Unknown/Other (please specify)
Last version that worked well
Unknown/Other
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
Android 9
Did you find any workaround?
No response
Relevant log output
No response
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Is there any workaround to address this requirement?
still not working
There was a workaround found in https://github.com/dotnet/maui/issues/9153#issuecomment-1295699420
Simplest workaround for me was adding an empty TapGestureRecognizer to the view that's over top.
As mentioned in the other issue https://github.com/dotnet/maui/issues/9153#issuecomment-1295699420 this is only an issue on Android as by default the other platforms intercept touches - Android does not. This is why in this PR: https://github.com/dotnet/maui/pull/13725 we have to add special code to make Android work like the rest.
It is also simpler to use this XAML:
<Grid>
<Grid Margin="10">
<Button Text="Click Me!" BackgroundColor="GreenYellow" Clicked="Button_Clicked"/>
</Grid>
<Grid BackgroundColor="Gray" Opacity="0.6" />
</Grid>
Still there.
I can see that all the issues related to this have been closed, but are there any plans for this issue?
Same problem occured on iOS platform, on version 8.0.61
Is there any progress? Or workaround?
@MarMarIV Look at https://github.com/dotnet/maui/issues/9153#issuecomment-1295699420 or https://github.com/dotnet/maui/issues/10252#issuecomment-1708522192
i have an issue in maui when i load data during this period when i click on my screen my app is crashing. if i dont touch the screen then its work fine . i have do every things like is enabled event fields dusring data loading but during loading click not click but after that it trigring all clicks and app will be crash. i have also async all function but still when i attach data its stucked for some time