Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue28986.xaml.cs
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue28986_Shell.cs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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.Issue32041AdjustPan"
Title="Issue 32041 AdjustPan">

<!-- Full-height container to test AdjustPan behavior -->
<!-- With AdjustPan, container height should NOT change (window pans instead) -->
<Grid x:Name="MainContainerPan"
AutomationId="MainContainerPan"
BackgroundColor="LightYellow"
RowDefinitions="*,Auto">

<VerticalStackLayout Grid.Row="0" Padding="20" Spacing="10">
<Label
Text="Test keyboard with SoftInput.AdjustPan"
FontSize="18"
FontAttributes="Bold"/>

<Label
Text="With AdjustPan, the container height should NOT change when keyboard appears. The window pans (moves) instead of resizing."
FontSize="14"
TextColor="DarkGreen"/>
</VerticalStackLayout>

<!-- Bottom marker -->
<Border Grid.Row="1"
AutomationId="BottomMarkerPan"
BackgroundColor="Green"
HeightRequest="60"
Margin="0">
<VerticalStackLayout Spacing="5" HorizontalOptions="Center" VerticalOptions="Center">
<Label
Text="BOTTOM MARKER (PAN)"
FontSize="12"
FontAttributes="Bold"
TextColor="White"
HorizontalOptions="Center"/>
<Entry
Placeholder="Tap here to show keyboard"
AutomationId="TestEntryPan"
BackgroundColor="White"
WidthRequest="250"/>
</VerticalStackLayout>
</Border>
</Grid>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -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
}
}
57 changes: 57 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue33276.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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.Issue33276"
Title="Issue 33276"
SafeAreaEdges="None">

<!-- Test for safe area padding restoration after keyboard closes -->
<!-- The safe area bottom padding should be restored when IME closes -->
<!-- Using a colored background on the container so we can see the padding -->
<Grid x:Name="MainContainer"
AutomationId="MainContainer"
BackgroundColor="Red"
SafeAreaEdges="All">

<!-- Inner content with different background to visualize padding -->
<Grid BackgroundColor="LightBlue"
RowDefinitions="*,Auto">

<VerticalStackLayout Grid.Row="0" Padding="20" Spacing="10">
<Label
Text="Test SafeArea padding restoration after keyboard"
FontSize="18"
FontAttributes="Bold"/>

<Label
Text="Open the keyboard by tapping the Entry below, then close it. The RED padding at the bottom should be restored after keyboard closes."
FontSize="14"
TextColor="DarkSlateGray"/>

<Label
AutomationId="PaddingStatusLabel"
x:Name="PaddingStatusLabel"
Text="Padding status: Initial"
FontSize="14"
TextColor="Navy"/>
</VerticalStackLayout>

<!-- Bottom marker at the very bottom of the inner content -->
<!-- This marker sits right above the safe area padding -->
<BoxView Grid.Row="1"
AutomationId="BottomMarker"
BackgroundColor="Green"
HeightRequest="50"/>
</Grid>

<!-- Entry placed in a fixed position to trigger keyboard -->
<Entry
Placeholder="Type something"
AutomationId="TestEntry"
BackgroundColor="White"
WidthRequest="250"
HorizontalOptions="Center"
VerticalOptions="End"
Margin="0,0,0,60"/>
</Grid>
</ContentPage>
35 changes: 35 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue33276.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 33276, "Padding not restored after SoftInput closes", PlatformAffected.Android)]
public partial class Issue33276 : ContentPage
{
public Issue33276()
{
InitializeComponent();
Comment thread
PureWeen marked this conversation as resolved.

// Log initial state
System.Diagnostics.Debug.WriteLine($"[Issue33276] Initial Padding: {MainContainer.Padding}");
Console.WriteLine($"[Issue33276] Initial Padding: {MainContainer.Padding}");

// Update padding status when it changes
MainContainer.PropertyChanged += (s, e) =>
{
if (e.PropertyName == nameof(Grid.Padding))
{
var padding = MainContainer.Padding;
PaddingStatusLabel.Text = $"Padding: L={padding.Left:F0}, T={padding.Top:F0}, R={padding.Right:F0}, B={padding.Bottom:F0}";
System.Diagnostics.Debug.WriteLine($"[Issue33276] Padding changed: {padding}");
Console.WriteLine($"[Issue33276] Padding changed: {padding}");
}
};

// Also update on layout
MainContainer.SizeChanged += (s, e) =>
{
var padding = MainContainer.Padding;
PaddingStatusLabel.Text = $"Padding: L={padding.Left:F0}, T={padding.Top:F0}, R={padding.Right:F0}, B={padding.Bottom:F0}";
System.Diagnostics.Debug.WriteLine($"[Issue33276] SizeChanged - Padding: {padding}");
Console.WriteLine($"[Issue33276] SizeChanged - Padding: {padding}");
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ public void SafeAreaPerEdgeValidation()
// Open Soft Input test entry
App.Tap("SoftInputTestEntry");

// With AdjustNothing mode, the window doesn't resize or pan
// The MainGrid gets bottom padding from SoftInput, so ContentGrid should shrink
App.RetryAssert(() =>
{
var containerPositionWithSoftInput = App.WaitForElement("ContentGrid").GetRect();
Assert.That(containerPositionWithSoftInput.Height, Is.LessThan(containerPosition.Height), "ContentGrid height should be less when Soft Input is shown with Container edges");
Assert.That(containerPositionWithSoftInput.Height, Is.LessThan(containerPosition.Height), "ContentGrid height should be less when keyboard shows - MainGrid gets bottom padding from SoftInput");
});

App.DismissKeyboard();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ public void SafeAreaPerEdgeValidation()
// Open Soft Input test entry
App.Tap("SoftInputTestEntry");

// With AdjustNothing mode, the window doesn't resize or pan
// The MainGrid gets bottom padding from SoftInput, so ContentGrid should shrink
App.RetryAssert(() =>
{
var containerPositionWithSoftInput = App.WaitForElement("ContentGrid").GetRect();
Assert.That(containerPositionWithSoftInput.Height, Is.LessThan(containerPosition.Height), "ContentGrid height should be less when Soft Input is shown with Container edges");
Assert.That(containerPositionWithSoftInput.Height, Is.LessThan(containerPosition.Height), "ContentGrid height should be less when keyboard shows - MainGrid gets bottom padding from SoftInput");
});

App.DismissKeyboard();
Expand Down
Loading
Loading