Skip to content

Commit

Permalink
[release/9.0.1xx-sr1] Remove code that enables/disables Entry (#26107)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Nov 26, 2024
1 parent 84abe93 commit 4b7be58
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 12 deletions.
70 changes: 70 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue25829.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?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="Maui.Controls.Sample.Issues.Issue25829"
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues">
<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">

<Button x:Name="testButton"
Text="This Button Should be Visible" Clicked="OnButtonClicked"
SemanticProperties.HeadingLevel="Level1" />

<Image
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a hovercraft number nine" />


<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"

HorizontalOptions="Fill" />
<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"

HorizontalOptions="Fill" />
<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"

HorizontalOptions="Fill" />
<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
HorizontalOptions="Fill" />
<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
HorizontalOptions="Fill" />
<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
HorizontalOptions="Fill" />
<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
HorizontalOptions="Fill" />
<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
HorizontalOptions="Fill" />
<Button
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
HorizontalOptions="Fill" />

<Entry Text=""></Entry>
<Entry Text="Entry Field"></Entry>
<Entry Text="Entry Field"></Entry>
<Entry Text="Entry Field"></Entry>
<Entry Text="Entry Field"></Entry>
<Entry Text="Entry Field"></Entry>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
31 changes: 31 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue25829.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Maui.Controls.Sample.Issues;


[Issue(IssueTracker.Github, 25829, "ScrollView starts at the position of first Entry control on the bottom rather than at 0",
PlatformAffected.Android)]
public partial class Issue25829 : ContentPage
{
public Issue25829()
{
InitializeComponent();
}

protected override void OnAppearing()
{
base.OnAppearing();

if(this.Navigation.ModalStack.Contains(this))
{
testButton.AutomationId = "Success";
}
else
{
testButton.AutomationId = "PushModal";
}
}

public async void OnButtonClicked(object sender, EventArgs e)
{
await Navigation.PushModalAsync(new Issue25829());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
using System.Threading.Tasks;
namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue25829 : _IssuesUITest
{
public Issue25829(TestDevice device) : base(device) { }

public override string Issue => "ScrollView starts at the position of first Entry control on the bottom rather than at 0";

[Test]
[Category(UITestCategories.Entry)]
public void ScrollViewStartsOccasionallyStartsAtTheFirstEntry()
{
App.WaitForElement("PushModal");
App.Tap("PushModal");
App.WaitForElement("Success");
App.Tap("Success");
}
}
}
12 changes: 0 additions & 12 deletions src/Core/src/Handlers/Entry/EntryHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public override void SetVirtualView(IView view)
// TODO: NET8 issoto - Change the return type to MauiAppCompatEditText
protected override void ConnectHandler(AppCompatEditText platformView)
{
platformView.ViewAttachedToWindow += OnPlatformViewAttachedToWindow;
platformView.TextChanged += OnTextChanged;
platformView.FocusChange += OnFocusedChange;
platformView.Touch += OnTouch;
Expand All @@ -53,7 +52,6 @@ protected override void ConnectHandler(AppCompatEditText platformView)
protected override void DisconnectHandler(AppCompatEditText platformView)
{
_clearButtonDrawable = null;
platformView.ViewAttachedToWindow -= OnPlatformViewAttachedToWindow;
platformView.TextChanged -= OnTextChanged;
platformView.FocusChange -= OnFocusedChange;
platformView.Touch -= OnTouch;
Expand Down Expand Up @@ -147,16 +145,6 @@ static void MapFocus(IEntryHandler handler, IEntry entry, object? args)
handler.PlatformView.Focus(request);
}

void OnPlatformViewAttachedToWindow(object? sender, ViewAttachedToWindowEventArgs e)
{
if (PlatformView.IsAlive() && PlatformView.Enabled)
{
// https://issuetracker.google.com/issues/37095917
PlatformView.Enabled = false;
PlatformView.Enabled = true;
}
}

void OnTextChanged(object? sender, TextChangedEventArgs e)
{
if (VirtualView == null)
Expand Down

0 comments on commit 4b7be58

Please sign in to comment.