diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986.xaml.cs
index bf066c9cc951..af4b8a49e846 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986.xaml.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea attached property for per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 0)]
@@ -7,6 +11,12 @@ public Issue28986()
{
InitializeComponent();
UpdateCurrentSettingsLabel();
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
private void OnGridSetNoneClicked(object sender, EventArgs e)
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Border.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Border.xaml.cs
index f3586378ccaf..cf523e096fd8 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Border.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Border.xaml.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea Border for per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 1)]
@@ -13,6 +17,12 @@ public Issue28986_Border()
BottomPicker.SelectedIndex = 3; // All
UpdateSafeAreaSettings();
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
private void OnEdgePickerChanged(object sender, EventArgs e)
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ContentPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ContentPage.xaml.cs
index f7c7ada8bdfd..18e3dc51d5e1 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ContentPage.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ContentPage.xaml.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea ContentPage for per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 2)]
@@ -7,6 +11,12 @@ public Issue28986_ContentPage()
{
InitializeComponent();
UpdateCurrentSettingsLabel();
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
private void OnGridSetNoneClicked(object sender, EventArgs e)
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ContentView.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ContentView.xaml.cs
index 6eeed5888845..4d8f3d81bf47 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ContentView.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ContentView.xaml.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea ContentView for per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 3)]
@@ -13,6 +17,12 @@ public Issue28986_ContentView()
BottomPicker.SelectedIndex = 3; // All
UpdateSafeAreaSettings();
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
private void OnEdgePickerChanged(object sender, EventArgs e)
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_FlyoutPage.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_FlyoutPage.cs
index edc5f7e155f0..ac39c1a29769 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_FlyoutPage.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_FlyoutPage.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea Flyout Page for per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 8)]
@@ -20,5 +24,11 @@ public Issue28986_FlyoutPage() : base()
}
}
};
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
}
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_NavigationPage.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_NavigationPage.cs
index 2098bacfe588..84598adb0a16 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_NavigationPage.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_NavigationPage.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea Navigation Page for per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 7)]
@@ -6,5 +10,11 @@ public partial class Issue28986_NavigationPage : NavigationPage
public Issue28986_NavigationPage() : base(new Issue28986_ContentPage())
{
BarBackground = Colors.Blue;
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
}
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_SafeAreaBorderOrientation.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_SafeAreaBorderOrientation.xaml.cs
index c594d656e000..be0dbb491662 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_SafeAreaBorderOrientation.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_SafeAreaBorderOrientation.xaml.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 5)]
@@ -18,6 +22,12 @@ public Issue28986_SafeAreaBorderOrientation()
// Update dimensions when the page appears
this.Appearing += OnPageAppearing;
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
private void OnPageAppearing(object sender, EventArgs e)
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ScrollView.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ScrollView.xaml.cs
index 42efd57f46b6..122bd03fbf59 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ScrollView.xaml.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ScrollView.xaml.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea ScrollView for per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 4)]
@@ -7,6 +11,12 @@ public Issue28986_ScrollView()
{
InitializeComponent();
UpdateCurrentSettingsLabel();
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
private void OnScrollViewSetNoneClicked(object sender, EventArgs e)
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Shell.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Shell.cs
index 33500e051962..58687816c105 100644
--- a/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Shell.cs
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Shell.cs
@@ -1,3 +1,7 @@
+#if ANDROID
+using Android.Views;
+#endif
+
namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 28986, "Test SafeArea Shell Page for per-edge safe area control", PlatformAffected.Android | PlatformAffected.iOS, issueTestNumber: 6)]
@@ -33,5 +37,11 @@ public Issue28986_Shell() : base()
}
}
});
+
+#if ANDROID
+ // Set SoftInput.AdjustNothing - we have full control over insets (iOS-like behavior)
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustNothing | SoftInput.StateUnspecified);
+#endif
}
}
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041.xaml
new file mode 100644
index 000000000000..d9d737fb8da6
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041.xaml.cs
new file mode 100644
index 000000000000..304b816103e6
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041.xaml.cs
@@ -0,0 +1,21 @@
+#if ANDROID
+using Android.Views;
+#endif
+
+namespace Maui.Controls.Sample.Issues;
+
+[Issue(IssueTracker.Github, 32041, "Keyboard overlaps Entry when SoftInput.AdjustResize is set", PlatformAffected.Android)]
+public partial class Issue32041 : ContentPage
+{
+ public Issue32041()
+ {
+ InitializeComponent();
+
+#if ANDROID
+ // Set SoftInput.AdjustResize to simulate the user's scenario
+ // This should cause the content to be resized (not overlapped) when the keyboard appears
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustResize | SoftInput.StateUnspecified);
+#endif
+ }
+}
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041AdjustPan.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041AdjustPan.xaml
new file mode 100644
index 000000000000..3af1bd213099
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041AdjustPan.xaml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041AdjustPan.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041AdjustPan.xaml.cs
new file mode 100644
index 000000000000..b5bf5d5cca80
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041AdjustPan.xaml.cs
@@ -0,0 +1,21 @@
+#if ANDROID
+using Android.Views;
+#endif
+
+namespace Maui.Controls.Sample.Issues;
+
+[Issue(IssueTracker.Github, 32041, "Verify AdjustPan mode does not apply keyboard insets", PlatformAffected.Android, issueTestNumber: 2)]
+public partial class Issue32041AdjustPan : ContentPage
+{
+ public Issue32041AdjustPan()
+ {
+ InitializeComponent();
+
+#if ANDROID
+ // Set SoftInput.AdjustPan - this should NOT apply insets
+ // The window should pan instead
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustPan | SoftInput.StateUnspecified);
+#endif
+ }
+}
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041FlyoutPage.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041FlyoutPage.xaml
new file mode 100644
index 000000000000..a9cb78c76a4e
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041FlyoutPage.xaml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041FlyoutPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041FlyoutPage.xaml.cs
new file mode 100644
index 000000000000..40f52af4521e
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041FlyoutPage.xaml.cs
@@ -0,0 +1,25 @@
+#if ANDROID
+using Android.Views;
+#endif
+
+namespace Maui.Controls.Sample.Issues;
+
+[Issue(IssueTracker.Github, 32041, "FlyoutPage - Keyboard overlaps when SoftInput.AdjustResize is set", PlatformAffected.Android, issueTestNumber: 4)]
+public partial class Issue32041FlyoutPage : FlyoutPage
+{
+ public Issue32041FlyoutPage()
+ {
+ InitializeComponent();
+
+#if ANDROID
+ // Set SoftInput.AdjustResize - the entire FlyoutPage container should resize
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustResize | SoftInput.StateUnspecified);
+#endif
+ }
+
+ private void OnToggleFlyout(object sender, EventArgs e)
+ {
+ IsPresented = !IsPresented;
+ }
+}
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041Shell.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041Shell.xaml
new file mode 100644
index 000000000000..169c859d444e
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041Shell.xaml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041Shell.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041Shell.xaml.cs
new file mode 100644
index 000000000000..23129027d6b6
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041Shell.xaml.cs
@@ -0,0 +1,20 @@
+#if ANDROID
+using Android.Views;
+#endif
+
+namespace Maui.Controls.Sample.Issues;
+
+[Issue(IssueTracker.Github, 32041, "Shell with bottom tabs - Keyboard overlaps when SoftInput.AdjustResize is set", PlatformAffected.Android, issueTestNumber: 5)]
+public partial class Issue32041Shell : Shell
+{
+ public Issue32041Shell()
+ {
+ InitializeComponent();
+
+#if ANDROID
+ // Set SoftInput.AdjustResize - the entire Shell container (including bottom tabs) should resize
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustResize | SoftInput.StateUnspecified);
+#endif
+ }
+}
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041TabbedPage.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041TabbedPage.xaml
new file mode 100644
index 000000000000..9790caf10de5
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041TabbedPage.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue32041TabbedPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041TabbedPage.xaml.cs
new file mode 100644
index 000000000000..d687b3ebf395
--- /dev/null
+++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue32041TabbedPage.xaml.cs
@@ -0,0 +1,20 @@
+#if ANDROID
+using Android.Views;
+#endif
+
+namespace Maui.Controls.Sample.Issues;
+
+[Issue(IssueTracker.Github, 32041, "TabbedPage - Keyboard overlaps when SoftInput.AdjustResize is set", PlatformAffected.Android, issueTestNumber: 3)]
+public partial class Issue32041TabbedPage : TabbedPage
+{
+ public Issue32041TabbedPage()
+ {
+ InitializeComponent();
+
+#if ANDROID
+ // Set SoftInput.AdjustResize - the entire TabbedPage container (including tabs) should resize
+ var window = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window;
+ window?.SetSoftInputMode(SoftInput.AdjustResize | SoftInput.StateUnspecified);
+#endif
+ }
+}
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041.cs
new file mode 100644
index 000000000000..ccfd3f9e0624
--- /dev/null
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041.cs
@@ -0,0 +1,107 @@
+#if ANDROID
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.TestCases.Tests.Issues;
+
+public class Issue32041 : _IssuesUITest
+{
+ public override string Issue => "Keyboard overlaps Entry when SoftInput.AdjustResize is set";
+
+ public Issue32041(TestDevice device) : base(device)
+ {
+ }
+
+ [Test]
+ [Category(UITestCategories.SafeAreaEdges)]
+ public void VerifyContainerResizesWithAdjustResize()
+ {
+ // Wait for the main container to be visible
+ App.WaitForElement("MainContainer");
+
+ // Get the bottom marker's initial position before keyboard appears
+ var bottomMarkerBefore = App.FindElement("BottomMarker").GetRect();
+ var initialBottom = bottomMarkerBefore.Y + bottomMarkerBefore.Height;
+
+ // Tap the entry to show the keyboard
+ App.Tap("TestEntry");
+
+ // Wait for keyboard to appear and layout to adjust
+ // Keyboard animation can take 300-500ms, plus layout adjustment time
+ Task.Delay(1500).Wait();
+
+ // Get the bottom marker's position after keyboard appears
+ var bottomMarkerAfter = App.FindElement("BottomMarker").GetRect();
+ var afterBottom = bottomMarkerAfter.Y + bottomMarkerAfter.Height;
+
+ // With AdjustResize, the bottom marker should move up (Y position decreases) to stay above keyboard
+ // This verifies that padding was applied to push content up
+ Assert.That(afterBottom, Is.LessThan(initialBottom),
+ $"Bottom marker should move up when keyboard appears with AdjustResize. Before Y: {initialBottom}px, After Y: {afterBottom}px");
+
+ // The upward movement should be significant (at least 200px for a typical keyboard)
+ var upwardMovement = initialBottom - afterBottom;
+ Assert.That(upwardMovement, Is.GreaterThan(200),
+ $"Bottom marker should move up by at least 200px (typical keyboard height). Actual movement: {upwardMovement}px");
+
+ // Verify the bottom marker is still visible and accessible
+ var bottomMarker = App.FindElement("BottomMarker");
+ Assert.That(bottomMarker, Is.Not.Null,
+ "Bottom marker should remain visible and accessible after keyboard appears");
+
+ // Verify the entry field is still interactive after closing the keyboard
+ App.DismissKeyboard();
+ Thread.Sleep(500); // Wait for keyboard to dismiss
+
+ var bottomMarkerAfterKeyboardClose = App.FindElement("BottomMarker").GetRect();
+ var afterKeyboardCloseBottom = bottomMarkerAfterKeyboardClose.Y + bottomMarkerAfterKeyboardClose.Height;
+
+ Assert.That(afterKeyboardCloseBottom, Is.EqualTo(initialBottom),
+ "Bottom marker should return to initial position after keyboard is dismissed");
+ }
+}
+
+public class Issue32041AdjustPan : _IssuesUITest
+{
+ public override string Issue => "Verify AdjustPan mode does not apply keyboard insets";
+
+ public Issue32041AdjustPan(TestDevice device) : base(device)
+ {
+ }
+
+ [Test]
+ [Category(UITestCategories.SafeAreaEdges)]
+ public void VerifyContainerDoesNotResizeWithAdjustPan()
+ {
+ // Wait for the main container to be visible
+ App.WaitForElement("MainContainerPan");
+
+ // Verify the bottom marker is visible and accessible before keyboard
+ App.WaitForElement("BottomMarkerPan");
+ var bottomMarkerBefore = App.FindElement("BottomMarkerPan").GetRect();
+
+ // Tap the entry to show the keyboard
+ App.Tap("TestEntryPan");
+
+ // Wait for keyboard to appear and layout to settle
+ Task.Delay(1500).Wait();
+
+ // With AdjustPan, the window pans (moves up) rather than resizing content
+ // The bottom marker should still be accessible (just panned up, not cut off)
+ // Note: Appium's GetRect() returns visible bounds, so height may differ when panned
+ // The key is that the element remains accessible and interactive
+ App.WaitForElement("BottomMarkerPan");
+ var bottomMarkerAfter = App.FindElement("BottomMarkerPan").GetRect();
+
+ // Verify the bottom marker is still present and has reasonable dimensions
+ // With panning, the marker moves but maintains its structure
+ Assert.That(bottomMarkerAfter.Height, Is.GreaterThan(0),
+ "Bottom marker should remain accessible with AdjustPan (window pans instead of resizing)");
+
+ // Verify the entry field is still interactive after panning
+ Assert.DoesNotThrow(() => App.FindElement("TestEntryPan"),
+ "Entry should remain accessible after keyboard appears with AdjustPan");
+ }
+}
+#endif
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041FlyoutPage.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041FlyoutPage.cs
new file mode 100644
index 000000000000..371d2cead73d
--- /dev/null
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041FlyoutPage.cs
@@ -0,0 +1,53 @@
+#if ANDROID
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.TestCases.Tests.Issues;
+
+public class Issue32041FlyoutPage : _IssuesUITest
+{
+ public override string Issue => "FlyoutPage - Keyboard overlaps when SoftInput.AdjustResize is set";
+
+ public Issue32041FlyoutPage(TestDevice device) : base(device)
+ {
+ }
+
+ [Test]
+ [Category(UITestCategories.FlyoutPage)]
+ public void FlyoutPageContainerResizesWithAdjustResize()
+ {
+ // Wait for the main container to be visible
+ App.WaitForElement("MainContainer");
+
+ // Get the container's initial height before keyboard appears
+ var containerBeforeKeyboard = App.FindElement("MainContainer").GetRect();
+ var initialHeight = containerBeforeKeyboard.Height;
+
+ // Tap the entry to show the keyboard
+ App.Tap("TestEntry");
+
+ // Wait for keyboard to appear and layout to adjust
+ Task.Delay(1500).Wait();
+
+ // Get the container's height after keyboard appears
+ var containerAfterKeyboard = App.FindElement("MainContainer").GetRect();
+ var resizedHeight = containerAfterKeyboard.Height;
+
+ // With AdjustResize, the entire FlyoutPage detail container should shrink (height decreases)
+ // This ensures both flyout and detail content stay above the keyboard
+ Assert.That(resizedHeight, Is.LessThan(initialHeight),
+ $"FlyoutPage detail container should resize (height decrease) when keyboard appears with AdjustResize. Before: {initialHeight}px, After: {resizedHeight}px");
+
+ // The height reduction should be significant (at least 200px for a typical keyboard)
+ var heightReduction = initialHeight - resizedHeight;
+ Assert.That(heightReduction, Is.GreaterThan(200),
+ $"Container should shrink by at least 200px (typical keyboard height). Actual reduction: {heightReduction}px");
+
+ // Verify the bottom marker is still visible and accessible
+ var bottomMarker = App.FindElement("BottomMarker");
+ Assert.That(bottomMarker, Is.Not.Null,
+ "Bottom marker should remain visible and accessible after keyboard appears");
+ }
+}
+#endif
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041Shell.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041Shell.cs
new file mode 100644
index 000000000000..b3e684ce0e7c
--- /dev/null
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041Shell.cs
@@ -0,0 +1,53 @@
+#if ANDROID
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.TestCases.Tests.Issues;
+
+public class Issue32041Shell : _IssuesUITest
+{
+ public override string Issue => "Shell with bottom tabs - Keyboard overlaps when SoftInput.AdjustResize is set";
+
+ public Issue32041Shell(TestDevice device) : base(device)
+ {
+ }
+
+ [Test]
+ [Category(UITestCategories.Shell)]
+ public void ShellContainerResizesWithAdjustResize()
+ {
+ // Wait for the main container to be visible
+ App.WaitForElement("MainContainer");
+
+ // Get the container's initial height before keyboard appears
+ var containerBeforeKeyboard = App.FindElement("MainContainer").GetRect();
+ var initialHeight = containerBeforeKeyboard.Height;
+
+ // Tap the entry to show the keyboard
+ App.Tap("TestEntry");
+
+ // Wait for keyboard to appear and layout to adjust
+ Task.Delay(1500).Wait();
+
+ // Get the container's height after keyboard appears
+ var containerAfterKeyboard = App.FindElement("MainContainer").GetRect();
+ var resizedHeight = containerAfterKeyboard.Height;
+
+ // With AdjustResize, the entire Shell container should shrink (height decreases)
+ // This ensures the bottom tab bar moves up and stays above the keyboard
+ Assert.That(resizedHeight, Is.LessThan(initialHeight),
+ $"Shell container should resize (height decrease) when keyboard appears with AdjustResize. Before: {initialHeight}px, After: {resizedHeight}px");
+
+ // The height reduction should be significant (at least 200px for a typical keyboard)
+ var heightReduction = initialHeight - resizedHeight;
+ Assert.That(heightReduction, Is.GreaterThan(200),
+ $"Container should shrink by at least 200px (typical keyboard height). Actual reduction: {heightReduction}px");
+
+ // Verify the bottom marker is still visible and accessible
+ var bottomMarker = App.FindElement("BottomMarker");
+ Assert.That(bottomMarker, Is.Not.Null,
+ "Bottom marker should remain visible and accessible after keyboard appears");
+ }
+}
+#endif
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041TabbedPage.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041TabbedPage.cs
new file mode 100644
index 000000000000..bddf58394ace
--- /dev/null
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32041TabbedPage.cs
@@ -0,0 +1,53 @@
+#if ANDROID
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.TestCases.Tests.Issues;
+
+public class Issue32041TabbedPage : _IssuesUITest
+{
+ public override string Issue => "TabbedPage - Keyboard overlaps when SoftInput.AdjustResize is set";
+
+ public Issue32041TabbedPage(TestDevice device) : base(device)
+ {
+ }
+
+ [Test]
+ [Category(UITestCategories.TabbedPage)]
+ public void TabbedPageContainerResizesWithAdjustResize()
+ {
+ // Wait for the main container to be visible
+ App.WaitForElement("MainContainer");
+
+ // Get the container's initial height before keyboard appears
+ var containerBeforeKeyboard = App.FindElement("MainContainer").GetRect();
+ var initialHeight = containerBeforeKeyboard.Height;
+
+ // Tap the entry to show the keyboard
+ App.Tap("TestEntry");
+
+ // Wait for keyboard to appear and layout to adjust
+ Task.Delay(1500).Wait();
+
+ // Get the container's height after keyboard appears
+ var containerAfterKeyboard = App.FindElement("MainContainer").GetRect();
+ var resizedHeight = containerAfterKeyboard.Height;
+
+ // With AdjustResize, the entire TabbedPage container should shrink (height decreases)
+ // This ensures the tab bar at the bottom moves up and stays above the keyboard
+ Assert.That(resizedHeight, Is.LessThan(initialHeight),
+ $"TabbedPage container should resize (height decrease) when keyboard appears with AdjustResize. Before: {initialHeight}px, After: {resizedHeight}px");
+
+ // The height reduction should be significant (at least 200px for a typical keyboard)
+ var heightReduction = initialHeight - resizedHeight;
+ Assert.That(heightReduction, Is.GreaterThan(200),
+ $"Container should shrink by at least 200px (typical keyboard height). Actual reduction: {heightReduction}px");
+
+ // Verify the bottom marker is still visible and accessible
+ var bottomMarker = App.FindElement("BottomMarker");
+ Assert.That(bottomMarker, Is.Not.Null,
+ "Bottom marker should remain visible and accessible after keyboard appears");
+ }
+}
+#endif
diff --git a/src/Core/src/Platform/Android/SafeAreaExtensions.cs b/src/Core/src/Platform/Android/SafeAreaExtensions.cs
index faf4cbbe06dc..4c294e7f16bb 100644
--- a/src/Core/src/Platform/Android/SafeAreaExtensions.cs
+++ b/src/Core/src/Platform/Android/SafeAreaExtensions.cs
@@ -8,6 +8,16 @@ namespace Microsoft.Maui.Platform;
internal static class SafeAreaExtensions
{
+ // Edge indices for safe area calculations
+ private const int EdgeLeft = 0;
+ private const int EdgeTop = 1;
+ private const int EdgeRight = 2;
+ private const int EdgeBottom = 3;
+
+ // SoftInput adjust mask constant (0xf0) to extract the adjust mode from SoftInput flags
+ // This allows us to distinguish between AdjustResize (0x10), AdjustPan (0x20), and AdjustNothing (0x30)
+ private const SoftInput AdjustMask = (SoftInput)0xf0;
+
internal static ISafeAreaView2? GetSafeAreaView2(object? layout) =>
layout switch
{
@@ -50,50 +60,56 @@ internal static SafeAreaRegions GetSafeAreaRegionForEdge(int edge, ICrossPlatfor
var keyboardInsets = windowInsets.GetKeyboardInsetsPx(context);
var isKeyboardShowing = !keyboardInsets.IsEmpty;
+ // Get the window's SoftInputMode to check if AdjustResize is set
+ var window = context.GetActivity()?.Window;
+ var softInputMode = window?.Attributes?.SoftInputMode ?? SoftInput.StateUnspecified;
+
+ // When AdjustPan is set with keyboard showing, consume all insets to prevent any view from applying padding
+ // Android handles window panning automatically - we don't want additional inset padding
+ bool isAdjustPan = isKeyboardShowing &&
+ (softInputMode & AdjustMask) == SoftInput.AdjustPan;
+
+ if (isAdjustPan)
+ {
+ // With AdjustPan, consume ALL insets - don't apply any safe area padding
+ // Android will handle the window panning behavior
+ return WindowInsetsCompat.Consumed;
+ }
+
var layout = crossPlatformLayout;
var safeAreaView2 = GetSafeAreaView2(layout);
var margins = (safeAreaView2 as IView)?.Margin ?? Thickness.Zero;
- if (safeAreaView2 is not null)
+ // When AdjustResize is set, we need to pad the container even if there's no SafeAreaView2
+ // This ensures drawer layouts, coordinator layouts, and other containers are properly adjusted
+ // Note: We must check specifically for AdjustResize, not AdjustPan or AdjustNothing
+ bool shouldApplyAdjustResize = isKeyboardShowing &&
+ (softInputMode & AdjustMask) == SoftInput.AdjustResize;
+
+ if (safeAreaView2 is not null || shouldApplyAdjustResize)
{
// Apply safe area selectively per edge based on SafeAreaRegions
- var left = GetSafeAreaForEdge(GetSafeAreaRegionForEdge(0, layout), baseSafeArea.Left, 0, isKeyboardShowing, keyboardInsets);
- var top = GetSafeAreaForEdge(GetSafeAreaRegionForEdge(1, layout), baseSafeArea.Top, 1, isKeyboardShowing, keyboardInsets);
- var right = GetSafeAreaForEdge(GetSafeAreaRegionForEdge(2, layout), baseSafeArea.Right, 2, isKeyboardShowing, keyboardInsets);
- var bottom = GetSafeAreaForEdge(GetSafeAreaRegionForEdge(3, layout), baseSafeArea.Bottom, 3, isKeyboardShowing, keyboardInsets);
+ var left = GetSafeAreaForEdge(GetSafeAreaRegionForEdge(EdgeLeft, layout), baseSafeArea.Left, EdgeLeft, isKeyboardShowing, keyboardInsets, softInputMode);
+ var top = GetSafeAreaForEdge(GetSafeAreaRegionForEdge(EdgeTop, layout), baseSafeArea.Top, EdgeTop, isKeyboardShowing, keyboardInsets, softInputMode);
+ var right = GetSafeAreaForEdge(GetSafeAreaRegionForEdge(EdgeRight, layout), baseSafeArea.Right, EdgeRight, isKeyboardShowing, keyboardInsets, softInputMode);
+ var bottom = GetSafeAreaForEdge(GetSafeAreaRegionForEdge(EdgeBottom, layout), baseSafeArea.Bottom, EdgeBottom, isKeyboardShowing, keyboardInsets, softInputMode);
var globalWindowInsetsListener = MauiWindowInsetListener.FindListenerForView(view);
- bool hasTrackedViews = globalWindowInsetsListener?.HasTrackedView == true;
-
- // If this view has no safe area padding to apply, pass insets through to children
- // instead of consuming them. This allows child views with SafeAreaEdges set
- // to properly handle the insets even when the parent has SafeAreaEdges.None
- // However, if this view was previously tracked (had padding before), we need to
- // continue processing to reset the padding to 0
- if (left == 0 && right == 0 && top == 0 && bottom == 0)
- {
- // Only pass through if this view hasn't been tracked yet
- // If it was tracked, we need to reset its padding
- if (globalWindowInsetsListener?.IsViewTracked(view) != true)
- {
- // Don't consume insets - pass them through for potential child views to handle
- return windowInsets;
- }
- }
-
-
- if (isKeyboardShowing &&
- context.GetActivity()?.Window is Window window &&
- window?.Attributes is WindowManagerLayoutParams attr)
+ bool hasTrackedViews = globalWindowInsetsListener?.HasTrackedView == true;
+
+ // If this view has no safe area padding to apply, pass insets through to children
+ // instead of consuming them. This allows child views with SafeAreaEdges set
+ // to properly handle the insets even when the parent has SafeAreaEdges.None
+ // However, if this view was previously tracked (had padding before), we need to
+ // continue processing to reset the padding to 0
+ if (left == 0 && right == 0 && top == 0 && bottom == 0)
{
- // If the window is panned from the keyboard being open
- // and there isn't a bottom inset to apply then just don't touch anything
- var softInputMode = attr.SoftInputMode;
- if (softInputMode == SoftInput.AdjustPan
- && bottom == 0
- )
+ // Only pass through if this view hasn't been tracked yet
+ // If it was tracked, we need to reset its padding
+ if (globalWindowInsetsListener?.IsViewTracked(view) != true)
{
- return WindowInsetsCompat.Consumed;
+ // Don't consume insets - pass them through for potential child views to handle
+ return windowInsets;
}
}
@@ -103,11 +119,19 @@ internal static SafeAreaRegions GetSafeAreaRegionForEdge(int edge, ICrossPlatfor
var viewWidth = view.Width > 0 ? view.Width : view.MeasuredWidth;
var viewHeight = view.Height > 0 ? view.Height : view.MeasuredHeight;
+ // Check if this view was previously tracked (had padding)
+ var wasTracked = globalWindowInsetsListener?.IsViewTracked(view) == true;
+
if ((viewHeight > 0 && viewWidth > 0) || !hasTrackedViews)
{
if (left == 0 && right == 0 && top == 0 && bottom == 0)
{
view.SetPadding(0, 0, 0, 0);
+ if (wasTracked)
+ {
+ // If padding is now zero but view was previously tracked, untrack it
+ globalWindowInsetsListener?.ResetView(view);
+ }
return windowInsets;
}
@@ -158,7 +182,8 @@ internal static SafeAreaRegions GetSafeAreaRegionForEdge(int edge, ICrossPlatfor
}
// Bottom: how much the view extends into the bottom safe area
- if (bottom > 0 && viewBottom > (screenHeight - bottom))
+ // Use inclusive comparison so we keep padding when the view exactly meets the safe area boundary
+ if (bottom > 0 && viewBottom >= (screenHeight - bottom))
{
// Calculate the actual overlap amount
var bottomEdge = screenHeight - bottom;
@@ -169,7 +194,23 @@ internal static SafeAreaRegions GetSafeAreaRegionForEdge(int edge, ICrossPlatfor
// if the view height is zero because it hasn't done the first pass
// and we don't have any tracked views yet then we will apply the bottom inset
if (viewHeight > 0 || hasTrackedViews)
- bottom = 0;
+ {
+ // SPECIAL CASE: Preserve bottom padding ONLY during keyboard dismissal transitions in AdjustResize mode.
+ // When AdjustResize is active and keyboard dismisses, the view is temporarily compressed and
+ // doesn't reach the bottom edge. We preserve the padding to prevent content jumping during transition.
+ // Key conditions:
+ // 1. Must be in AdjustResize mode (not AdjustPan/AdjustNothing)
+ // 2. View was previously tracked with padding
+ // 3. Keyboard is not showing (just dismissed)
+ // 4. Gap is large (> 500px, indicating keyboard-sized compression)
+ bool isAdjustResize = (softInputMode & AdjustMask) == SoftInput.AdjustResize;
+ bool isKeyboardDismissalTransition = wasTracked && !isKeyboardShowing && bottom > 0 && (screenHeight - viewBottom) > 500;
+
+ if (!isKeyboardDismissalTransition || !isAdjustResize)
+ {
+ bottom = 0;
+ }
+ }
}
// Left: how much the view extends into the left safe area
@@ -246,6 +287,11 @@ internal static SafeAreaRegions GetSafeAreaRegionForEdge(int edge, ICrossPlatfor
{
globalWindowInsetsListener?.TrackView(view);
}
+ else if (wasTracked)
+ {
+ // If padding is now zero but view was previously tracked, untrack it
+ globalWindowInsetsListener?.ResetView(view);
+ }
}
else
{
@@ -261,35 +307,38 @@ internal static SafeAreaRegions GetSafeAreaRegionForEdge(int edge, ICrossPlatfor
return newWindowInsets;
}
- internal static double GetSafeAreaForEdge(SafeAreaRegions safeAreaRegion, double originalSafeArea, int edge, bool isKeyboardShowing, SafeAreaPadding keyBoardInsets)
+ internal static double GetSafeAreaForEdge(SafeAreaRegions safeAreaRegion, double originalSafeArea, int edge, bool isKeyboardShowing, SafeAreaPadding keyBoardInsets, SoftInput softInputMode = SoftInput.StateUnspecified)
{
+ // Handle SoftInput/keyboard specifically for bottom edge when keyboard is showing
+ // Check this BEFORE the SafeAreaRegions.None check to ensure AdjustResize works even without explicit SafeAreaEdges
+ if (isKeyboardShowing && edge == EdgeBottom)
+ {
+ // Apply keyboard insets if:
+ // 1. SafeAreaRegion explicitly includes SoftInput flag, OR
+ // 2. Window SoftInputMode is set to AdjustResize (to restore pre-regression behavior and handle containers without SafeAreaView2)
+ // Note: Must use AdjustMask to specifically check for AdjustResize, excluding AdjustPan/AdjustNothing
+ if (SafeAreaEdges.IsSoftInput(safeAreaRegion) ||
+ (softInputMode & AdjustMask) == SoftInput.AdjustResize)
+ {
+ return keyBoardInsets.Bottom;
+ }
+
+ // if the keyboard is showing then we will just return 0 for the bottom inset
+ // because that part of the view is covered by the keyboard so we don't want to pad the view
+ return 0;
+ }
+ else if (!isKeyboardShowing && SafeAreaEdges.IsOnlySoftInput(safeAreaRegion))
+ {
+ // For bottom edges when keyboard is hidden and region is only softinput, don't apply safe area insets
+ return 0;
+ }
+
// Edge-to-edge content - no safe area padding
if (safeAreaRegion == SafeAreaRegions.None)
{
return 0;
}
- // Handle SoftInput specifically - only apply keyboard insets for bottom edge when keyboard is showing
- if (edge == 3)
- {
- if (SafeAreaEdges.IsOnlySoftInput(safeAreaRegion))
- {
- // SoftInput only applies padding when keyboard is showing
- return isKeyboardShowing ? keyBoardInsets.Bottom : 0;
- }
-
- if (isKeyboardShowing)
- {
- // Return keyboard insets for any region that includes SoftInput
- if (SafeAreaEdges.IsSoftInput(safeAreaRegion))
- return keyBoardInsets.Bottom;
-
- // if the keyboard is showing then we will just return 0 for the bottom inset
- // because that part of the view is covered by the keyboard so we don't want to pad the view
- return 0;
- }
- }
-
// All other regions respect safe area in some form
// This includes:
// - Default: Platform default behavior