-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix keyboard overlap on Android when SoftInput.AdjustResize is set #32405
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
Conversation
|
/azp run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
|
|
||
| [Test] | ||
| [Category(UITestCategories.SafeAreaEdges)] | ||
| public void VerifyKeyboardDoesNotOverlapEntryWithAdjustResize() |
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.
Add a test for AdjustPan Mode. Current test validates AdjustResize; adding a pan-mode assertion ensures no regressions where pan doesn't apply insets incorrectly.
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.
Added AdjustPan test in commit ff901a2. The new test verifies that when SoftInput.AdjustPan is set, no keyboard insets are applied (the window pans instead).
|
@copilot , Add a test for AdjustPan Mode. Current test validates AdjustResize; adding a pan-mode assertion ensures no regressions where pan doesn't apply insets incorrectly. |
Added AdjustPan test in commit ff901a2. Created Issue32041AdjustPan test page and test case that verifies no insets are applied when AdjustPan mode is set. |
c036163 to
c004621
Compare
jsuarezruiz
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 Fix current conflict.
|
/rebase |
e93315f to
756a5f5
Compare
|
@copilot i have rebased this pr can you asses if your changes on this pr still seem correct? |
17fda3d to
6673467
Compare
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.
based on our chats
-
we need to fix adjustresize here so it works at the root level of the view, not just on the layouts inside the page. For example, if a page has bottom tabs those tabs should also resize up
-
I do still think there's a bug here to fix around the timing of the keyboad though because I think this issue will still happen if you were to set the layout itself to SafeAreaEdges.All
Can you create a new PR for a different implementation of AdjustResize to cover the first point and then lets keep working on this one to fix the timing. I still think there's a possible solution here that doesn't involve the magic 500px number check
Co-authored-by: PureWeen <[email protected]>
Co-authored-by: PureWeen <[email protected]> # Conflicts: # .gitignore
Co-authored-by: PureWeen <[email protected]> # Conflicts: # .gitignore
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Fixed a regression in .NET 10 RC2 where the keyboard overlaps Entry controls when developers set
SoftInput.AdjustResizein MainActivity, breaking the standard Android resize behavior that worked in .NET 9.Root Cause:
WindowCompat.SetDecorFitsSystemWindows(Window, false)inMauiAppCompatActivitydisabled automatic window resizing. The inset handler only applied keyboard padding whenSafeAreaRegions.SoftInputwas explicitly set, ignoring the window'sSoftInputMode.Changes Made:
SafeAreaExtensions.cs - Enhanced to detect window's
SoftInputModeand apply keyboard insets whenAdjustResizeis set, regardless ofSafeAreaRegionssettingsAdjustResizeis setApplyAdjustedSafeAreaInsetsPxGetSafeAreaForEdgeto return 0 for SoftInput-only regions when keyboard is hiddenUI Tests - Added comprehensive test coverage:
Cross-platform build fixes - Wrapped
using Android.Views;with#if ANDROIDin 14 test files to fix build errors on iOS, Windows, and MacCatalystKey Behavior:
SoftInput.AdjustResizeis set: Keyboard insets are applied to push content up, avoiding overlapSoftInput.AdjustPanis set: No insets applied (Android natively pans the window)SafeAreaEdges=SoftInputonly and keyboard is hidden: Returns 0 padding (no unnecessary safe area insets)All existing unit tests pass (45/45 SafeArea tests).
Issues Fixed
Fixes #32041
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.