maui icon indicating copy to clipboard operation
maui copied to clipboard

Overlaying a StackLayout on another StackLayout does not block interaction

Open alfarajali opened this issue 3 years ago • 6 comments

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

  1. Create a .net MAUI app
  2. 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>
  1. 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");
	}
}

  1. Run the app
  2. 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

alfarajali avatar Sep 22 '22 04:09 alfarajali

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.

ghost avatar Sep 22 '22 18:09 ghost

Is there any workaround to address this requirement?

alfarajali avatar Sep 23 '22 05:09 alfarajali

still not working

eynerdevp avatar Jan 04 '23 03:01 eynerdevp

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.

mattleibow avatar May 01 '23 15:05 mattleibow

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.

mattleibow avatar May 01 '23 15:05 mattleibow

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>

mattleibow avatar Sep 06 '23 14:09 mattleibow

Still there.

riccardominato avatar Mar 27 '24 16:03 riccardominato

I can see that all the issues related to this have been closed, but are there any plans for this issue?

maonaoda avatar Jun 25 '24 04:06 maonaoda

Same problem occured on iOS platform, on version 8.0.61

Is there any progress? Or workaround?

MarMarIV avatar Jul 03 '24 05:07 MarMarIV

@MarMarIV Look at https://github.com/dotnet/maui/issues/9153#issuecomment-1295699420 or https://github.com/dotnet/maui/issues/10252#issuecomment-1708522192

riccardominato avatar Jul 03 '24 06:07 riccardominato

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

yaseenCh avatar Jul 15 '24 07:07 yaseenCh