dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22k stars 1.72k forks source link

Layouts block input even when they do not have a background (null background) #19124

Open mattleibow opened 9 months ago

mattleibow commented 9 months ago

Description

.NET MAUI does things a bit different to other XAML worlds where a layout will block interaction unless that layout is explicitly marked as input transparent.

The default for other XAML platforms, like WinUI, is to allow interaction through the layout - unless you assign a background - even a transparent color. Setting a null background makes the layout no longer hit testable and input passes through.

I have seen arguments for both ways where adding a layout was expected to block but did not. Then setting a color suddenly changes this - especially if that color is transparent. The other side always expected the layout to not block for null/transparent because you can see through it.

Some options:

  1. Always block interaction unless InputTransparent="True" CURRENT
    • ✅ This is consistent with the layouts, color does not mean anything - only the InputTransparent property
    • ✅ The dev only has to think about one property to toggle input transparency
    • ✅ Adding a layout to add a loading screen or popup/modal blocks by default
    • ❌ This is different to all other XAML frameworks
  2. null backgrounds do not block, only transparent/colors
    • ✅ This is consistent with other XAML frameworks
    • ✅ Adding a layout over a UI to host something does not block unless told to do so
    • ❌ The only way to block input is to add a transparent background color
    • ❌ There is no visual difference to null vs Transparent color

Steps to Reproduce

<Grid>
    <Button />
    <Grid />
<Grid />
ghost commented 9 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

gktval commented 9 months ago

Following this issue. This is related to a previous issue I created, but closed. https://github.com/dotnet/maui/issues/18470