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
22.21k stars 1.75k forks source link

[Android] Unable to tap clear button in Entry when inside a Grid #14620

Open greg84 opened 1 year ago

greg84 commented 1 year ago

Description

On Android tapping the Entry's clear button does nothing. This is broken in the latest version (7.0.81).

Steps to Reproduce

Create a page with the following XAML:

    <Grid ColumnDefinitions="*, Auto, *">
        <Entry Grid.Column="1"
               VerticalOptions="Start"
               ClearButtonVisibility="WhileEditing"
               WidthRequest="240" />
    </Grid>

Run the app on Android.

Type some text in the Entry.

Attempt to press the clear button to clear the text.

The button does not work.

Link to public reproduction project repository

See steps to reproduce

Version with bug

7.0 (current) (Tested in 7.0.81 released last week - not working)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

All

Did you find any workaround?

The clear button works correctly if I change the Grid to a HorizontalStackLayout.

Relevant log output

No response

ghost commented 1 year 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.

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on Android 13.0-API33, not repro on Windows 11 and iOS 16.4 with below Project: 14620.zip

moljac commented 1 year ago

Verified both on MacOSX net7.0-android and net8.0-android

==============================================================================================================
Microsoft .NET
dotnet --info
.NET SDK:
 Version:   8.0.100-preview.7.23376.3
 Commit:    daebeea8ea

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.5
 OS Platform: Darwin
 RID:         osx.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.100-preview.7.23376.3/

.NET workloads installed:
 [wasm-tools]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    8.0.0-preview.7.23375.6/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.workload.mono.toolchain.current/WorkloadManifest.json
   Install Type:        FileBased

 [maui-windows]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    8.0.0-preview.7.8842/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maui/WorkloadManifest.json
   Install Type:        FileBased

 [macos]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    13.3.8694-net8-p7/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.macos/WorkloadManifest.json
   Install Type:        FileBased

 [maui-maccatalyst]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    8.0.0-preview.7.8842/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maui/WorkloadManifest.json
   Install Type:        FileBased

 [maui-ios]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    8.0.0-preview.7.8842/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maui/WorkloadManifest.json
   Install Type:        FileBased

 [maui-android]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    8.0.0-preview.7.8842/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maui/WorkloadManifest.json
   Install Type:        FileBased

 [ios]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    16.4.8694-net8-p7/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.ios/WorkloadManifest.json
   Install Type:        FileBased

 [maui-mobile]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    8.0.0-preview.7.8842/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maui/WorkloadManifest.json
   Install Type:        FileBased

 [maccatalyst]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    16.4.8694-net8-p7/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maccatalyst/WorkloadManifest.json
   Install Type:        FileBased

 [maui]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    8.0.0-preview.7.8842/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.maui/WorkloadManifest.json
   Install Type:        FileBased

 [tvos]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    16.4.8694-net8-p7/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.tvos/WorkloadManifest.json
   Install Type:        FileBased

 [android]
   Installation Source: SDK 8.0.100-preview.7
   Manifest Version:    34.0.0-preview.7.382/8.0.100-preview.7
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.7/microsoft.net.sdk.android/WorkloadManifest.json
   Install Type:        FileBased

Host:
  Version:      8.0.0-preview.7.23375.6
  Architecture: x64
  Commit:       65b696cf5e
  RID:          osx-x64

.NET SDKs installed:
  6.0.116 [/usr/local/share/dotnet/sdk]
  6.0.311 [/usr/local/share/dotnet/sdk]
  6.0.408 [/usr/local/share/dotnet/sdk]
  6.0.410 [/usr/local/share/dotnet/sdk]
  6.0.412 [/usr/local/share/dotnet/sdk]
  7.0.105 [/usr/local/share/dotnet/sdk]
  7.0.203 [/usr/local/share/dotnet/sdk]
  7.0.302 [/usr/local/share/dotnet/sdk]
  7.0.304 [/usr/local/share/dotnet/sdk]
  7.0.306 [/usr/local/share/dotnet/sdk]
  8.0.100-preview.7.23376.3 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
dotnet --list-sdks
6.0.116 [/usr/local/share/dotnet/sdk]
6.0.311 [/usr/local/share/dotnet/sdk]
6.0.408 [/usr/local/share/dotnet/sdk]
6.0.410 [/usr/local/share/dotnet/sdk]
6.0.412 [/usr/local/share/dotnet/sdk]
7.0.105 [/usr/local/share/dotnet/sdk]
7.0.203 [/usr/local/share/dotnet/sdk]
7.0.302 [/usr/local/share/dotnet/sdk]
7.0.304 [/usr/local/share/dotnet/sdk]
7.0.306 [/usr/local/share/dotnet/sdk]
8.0.100-preview.7.23376.3 [/usr/local/share/dotnet/sdk]
--------------------------------------------------------------------------------------------------------------
dotnet workload list

Installed Workload Id      Manifest Version                               Installation Source  
-----------------------------------------------------------------------------------------------
wasm-tools                 8.0.0-preview.7.23375.6/8.0.100-preview.7      SDK 8.0.100-preview.7
maui-windows               8.0.0-preview.7.8842/8.0.100-preview.7         SDK 8.0.100-preview.7
macos                      13.3.8694-net8-p7/8.0.100-preview.7            SDK 8.0.100-preview.7
maui-maccatalyst           8.0.0-preview.7.8842/8.0.100-preview.7         SDK 8.0.100-preview.7
maui-ios                   8.0.0-preview.7.8842/8.0.100-preview.7         SDK 8.0.100-preview.7
maui-android               8.0.0-preview.7.8842/8.0.100-preview.7         SDK 8.0.100-preview.7
ios                        16.4.8694-net8-p7/8.0.100-preview.7            SDK 8.0.100-preview.7
maui-mobile                8.0.0-preview.7.8842/8.0.100-preview.7         SDK 8.0.100-preview.7
maccatalyst                16.4.8694-net8-p7/8.0.100-preview.7            SDK 8.0.100-preview.7
maui                       8.0.0-preview.7.8842/8.0.100-preview.7         SDK 8.0.100-preview.7
tvos                       16.4.8694-net8-p7/8.0.100-preview.7            SDK 8.0.100-preview.7
android                    34.0.0-preview.7.382/8.0.100-preview.7         SDK 8.0.100-preview.7

Use `dotnet workload search` to find additional workloads to install.

Logfiles:

msbuild.binlog.zip bugreport-sdk_gphone64_x86_64-SE1A.220826.006.A1-2023-08-29-15-34-22.zip log_2023-08-29T15-33-55.txt

Samples with logs: 14620-sample+logs.zip

PureWeen commented 1 year ago

Related https://github.com/dotnet/maui/issues/17453

Quaybe commented 10 months ago

Another workaround if you want to continue to use a grid, you can wrap the entry in a VerticalStackLayout with zero padding:

"So if wrap Entry with VerticalStackLayout with zero padding, then clear button does its functionality"

<VerticalStackLayout Padding="0"> <Entry Text="Simple text" ClearButtonVisibility="WhileEditing" /> </VerticalStackLayout>

https://github.com/dotnet/maui/issues/17453#issuecomment-1723571787

davidlopez9210 commented 6 months ago

This is still hapening for me using latest version of Visual Studio 17.9.6 and MAUI NuGet packages 8.0.7 I ended up adding this workaround as Quaybe suggested:

<Grid>
        <VerticalStackLayout Padding="0">
                <Entry
                ClearButtonVisibility="WhileEditing"/>
        </VerticalStackLayout>
</Grid>

But for sure there is still an issue