-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix keyboard overlap issue and add UI tests for SoftInput modes on Android (Issue #32041) #33145
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
base: main
Are you sure you want to change the base?
Conversation
PureWeen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please remove everything from this PR except the Issue32041 files
| } | ||
| } | ||
|
|
||
| public class Issue32041AdjustPan : _IssuesUITest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please move this to a separate file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Moved Issue32041AdjustPan test class to a separate file: Issue32041AdjustPan.cs. (commit 6f399b5)
.gitignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot revert the changes to this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Restored the .gitignore file. (commit a031808)
|
@copilot use the pr-reviewer to review this pr Don't make changes just use the agent to give feedback |
The pr-reviewer has completed the review. Here's the feedback: ✅ Strengths:
The tests are well-structured overall but could benefit from timing consistency fixes and tolerance-based assertions for better reliability. |
|
@copilot please use pr-reviewer to review all changes in this pr not just the files you've modified Review the issue this is fixing and do a deep review of all code and possible other fixes |
The pr-reviewer has completed a comprehensive deep review of ALL changes in this PR, including the MauiWindowInsetListener.cs implementation fix. Here are the findings: 🔴 CRITICAL ISSUES:1. Keyboard Closure Bug - When keyboard closes (imeHeight == 0), the padding applied by 2. System Bar Insets Lost - Lines 221-249 consume bottom insets (including system navigation bar) but don't restore them after keyboard closes, potentially causing content to overlap system UI. 3. Production Debug Logging - 13+
|
|
@copilot , Remove the HybridWebView.js.map. |
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: NirmalKumarYuvaraj <97871636+NirmalKumarYuvaraj@users.noreply.github.com>
0f7227b to
df9acfb
Compare
…edPage bottom tabs - Extract duplicate CoordinatorLayout padding/margin logic into SetCoordinatorLayoutBottomSpace helper method - Add android:TabbedPage.ToolbarPlacement="Bottom" to Issue32041TabbedPage.xaml to properly test bottom tab behavior with keyboard
| xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue32041TabbedPage" | ||
| Title="Issue 32041 TabbedPage" | ||
| android:TabbedPage.ToolbarPlacement="Bottom"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NirmalKumarYuvaraj I changed this to bottom tabs and now when you open and close the keyboard it looks really off
I'm having my doubts about applying these changes to the coordinatorLayout
I might have led us down a wrong path there.....
We might need to apply the padding against the surrounding container. Like, just make sure the containerview is inside something?
Not sure what the correct approach is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PureWeen , I have added a fix for the TabbedPage overlap issue.
…om PR #33145) Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
PureWeen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@devanathan-vaithiyanathan I don't think the initial approach on this one with padding the Coordinator layout is correct.
For Adjust Resize I'm thinking we need to simplify this an apply the padding at a higher level. Like maybe we apply it on the Decor View? or the containerView? I think just adding the padding to the coordinator view is going to be just chasing lots of edge cases
…om PR #33145) Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
…om PR #33145) Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
) ## Summary Fix SafeArea inset handling when SoftInputMode is set to AdjustPan or AdjustNothing on Android. ## Problem When SoftInputMode is set to AdjustPan, the MAUI framework was incorrectly modifying padding when the keyboard appeared. With AdjustPan, Android handles keyboard visibility by panning the window, so MAUI should not apply any additional padding adjustments. ## Solution ### SafeAreaExtensions.cs Fix - Use `SoftInput.MaskAdjust` to properly detect AdjustPan mode (distinguishes from AdjustNothing) - When AdjustPan is detected, consume insets and return immediately without modifying padding - This allows Android's native AdjustPan behavior to work correctly ### Test Updates - Updated 9 Issue28986 SafeArea test files to explicitly set `SoftInput.AdjustNothing` for consistent test behavior - Added Issue32041AdjustPan test to validate AdjustPan mode behavior - Added Issue33276 test to validate safe area padding restoration after keyboard closes ## Files Changed - `src/Core/src/Platform/Android/SafeAreaExtensions.cs` - Core fix for AdjustPan detection - 9 Issue28986 test files - Set SoftInput.AdjustNothing mode - Issue32041AdjustPan test page and UI test - New test for AdjustPan validation - Issue33276 test page and UI test - New test for padding restoration validation <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > Create a new pr from this pr #33145 but only include the changes and tests related to adjustpan and adjustnone. Don't include anything related to adjustresize </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com> Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
|
I second what @PureWeen said, and I would add that IMHO the high level node should patch window insets rather than setting a padding. This would allow seamless integration with descendant scrollable areas without causing a full page resize. |
Fix keyboard overlap issue and add UI tests for SoftInput modes on Android (Issue #32041)
This PR fixes the keyboard overlap issue when
SoftInput.AdjustResizeis set on Android and adds comprehensive UI test infrastructure to validate the fix across different page types.Implementation Fix
MauiWindowInsetListener.cs:
ApplyKeyboardPaddingIfNeededmethod to detect AdjustResize mode and apply appropriate padding/margin to prevent content from being hidden behind the keyboardmint→int)SafeAreaExtensions.cs:
(softInputMode & SoftInput.AdjustPan) == SoftInput.AdjustPanto direct equalitysoftInputMode == SoftInput.AdjustPanfor more precise mode detectionSafeArea Test Configuration:
SoftInput.AdjustNothingon Android for proper SafeArea edge validationTest Infrastructure Added (15 files)
TestCases.HostApp - XAML Test Pages (10 files):
Issue32041.xaml/.cs- ContentPage testing SoftInput.AdjustResize modeIssue32041AdjustPan.xaml/.cs- ContentPage testing SoftInput.AdjustPan modeIssue32041Shell.xaml/.cs- Shell with bottom tabs testing AdjustResizeIssue32041TabbedPage.xaml/.cs- TabbedPage with bottom tabs testing AdjustResizeIssue32041FlyoutPage.xaml/.cs- FlyoutPage testing AdjustResizeEach test page includes:
#if ANDROIDdirectivesTestCases.Shared.Tests - NUnit UI Tests (5 files):
Issue32041.cs- Validates AdjustResize behavior (content resizes when keyboard appears)Issue32041AdjustPan.cs- Validates AdjustPan behavior (window pans instead of resizing)Issue32041Shell.cs- Validates Shell container resizing with keyboardIssue32041TabbedPage.cs- Validates TabbedPage container resizing with keyboardIssue32041FlyoutPage.cs- Validates FlyoutPage detail container resizing with keyboardTests use:
#if ANDROID)issueTestNumbervalues (1-5) for test variant disambiguationWhat This Fixes and Tests
The implementation fix and test suite validate:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.