diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/EditorShouldNotMoveToBottom.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/EditorShouldNotMoveToBottom.png new file mode 100644 index 000000000000..9e54390608ea Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/EditorShouldNotMoveToBottom.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue27750.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue27750.cs new file mode 100644 index 000000000000..4b156693ba22 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue27750.cs @@ -0,0 +1,40 @@ +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 27750, "[iOS] Editor scrolled to the bottom when tapped while inside the ScrollView", PlatformAffected.iOS)] +public partial class Issue27750 : ContentPage +{ + public Issue27750() + { + + var scrollView = new ScrollView(); + var grid = new Grid + { + RowDefinitions = new RowDefinitionCollection + { + new RowDefinition { Height = GridLength.Auto }, + new RowDefinition { Height = GridLength.Auto } + }, + RowSpacing = 4 + }; + var boxView = new BoxView + { + HeightRequest = 50, + BackgroundColor = Colors.Aqua, + }; + var editor = new UITestEditor + { + Placeholder = "Editor with 25 Height Request", + AutomationId = "Editor", + HeightRequest = 25, + IsCursorVisible = false, + TextColor = Colors.Black, + BackgroundColor = Colors.SpringGreen, + }; + grid.Children.Add(boxView); + grid.Children.Add(editor); + grid.SetRow(editor, 1); + + scrollView.Content = grid; + Content = scrollView; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/EditorShouldNotMoveToBottom.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/EditorShouldNotMoveToBottom.png new file mode 100644 index 000000000000..6578ce3df5da Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/EditorShouldNotMoveToBottom.png differ diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27750.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27750.cs new file mode 100644 index 000000000000..330cca389ada --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27750.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue27750 : _IssuesUITest + { + public override string Issue => "[iOS] Editor scrolled to the bottom when tapped while inside the ScrollView"; + + public Issue27750(TestDevice device) + : base(device) + { } + + [Test] + [Category(UITestCategories.Editor)] + public void EditorShouldNotMoveToBottom() + { + App.WaitForElement("Editor"); + App.Tap("Editor"); + + VerifyScreenshot(); + } + } +} diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/EditorShouldNotMoveToBottom.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/EditorShouldNotMoveToBottom.png new file mode 100644 index 000000000000..8abd51657eba Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/EditorShouldNotMoveToBottom.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/EditorShouldNotMoveToBottom.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/EditorShouldNotMoveToBottom.png new file mode 100644 index 000000000000..772063cc48b5 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/EditorShouldNotMoveToBottom.png differ diff --git a/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs b/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs index 4ebe250f61c0..4fe675055aa6 100644 --- a/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs +++ b/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs @@ -449,7 +449,7 @@ internal static void AdjustPosition() // scenario where we go into an editor with the "Next" keyboard button, // but the cursor location on the editor is scrolled below the visible section - if (View is UITextView && IsKeyboardShowing && cursorRect.Bottom >= viewRectInWindow.GetMaxY()) + if (View is UITextView && IsKeyboardShowing && cursorRect.Y >= viewRectInWindow.GetMaxY()) { move = viewRectInWindow.Bottom - (nfloat)bottomBoundary; }