-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix SafeArea AdjustPan handling and add AdjustNothing mode tests #33354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
PureWeen
merged 12 commits into
inflight/candidate
from
copilot/update-adjustpan-adjustnone-tests
Jan 6, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d6c4469
Initial plan
Copilot 0f1f16a
Add AdjustPan and AdjustNothing soft input mode changes and tests (fr…
Copilot 7c87544
Add UI test for Issue33276 - Safe area padding restoration after keyb…
Copilot 946fd1b
- submit tests
PureWeen a7f46e6
Fix AdjustPan mode to skip inset handling while keyboard is showing
PureWeen 4f27d4a
Restore bottom == 0 check for AdjustPan inset handling
PureWeen 3f9397b
Use SoftInput.MaskAdjust to properly detect AdjustPan mode
PureWeen ff0141d
Fix AdjustPan check: early exit unless SoftInput is explicitly set
PureWeen ab1b6eb
Fix AdjustPan handling: simplify to no-op when AdjustPan is set
Copilot d90cc4c
Update SafeAreaPerEdgeValidation tests for AdjustPan behavior
PureWeen cb60a16
Fix SafeAreaPerEdgeValidation test expectations and AdjustPan detection
PureWeen c1bea37
Address PR review comments
PureWeen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/Controls/tests/TestCases.HostApp/Issues/Issue32041AdjustPan.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
21 changes: 21 additions & 0 deletions
21
src/Controls/tests/TestCases.HostApp/Issues/Issue32041AdjustPan.xaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
57
src/Controls/tests/TestCases.HostApp/Issues/Issue33276.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
35
src/Controls/tests/TestCases.HostApp/Issues/Issue33276.xaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
|
|
||
| // 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}"); | ||
| }; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.