Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

  • Analyze the issue and understand the root cause
  • Modify SafeAreaExtensions.cs to check window SoftInputMode and apply keyboard insets when AdjustResize is set
  • Build and verify compilation succeeds
  • Create UI test to validate the fix
  • Run format to ensure code style compliance
  • Address code review feedback
  • Verify no regressions with existing tests
  • Add test for AdjustPan mode
  • Merge main to resolve conflicts

Summary

Fixed Issue #32041 where keyboard overlaps Entry controls when SoftInput.AdjustResize is set on Android. The fix modifies SafeAreaExtensions.cs to detect and respect the window's SoftInputMode setting, applying keyboard insets when AdjustResize is set even if SafeAreaRegions doesn't explicitly include the SoftInput flag.

All existing tests pass and comprehensive UI tests have been added:

  • Issue32041: Tests AdjustResize mode - verifies keyboard insets ARE applied
  • Issue32041AdjustPan: Tests AdjustPan mode - verifies keyboard insets are NOT applied

Successfully merged with main branch (commit e93315f).

Original prompt

This section details on the original issue you should resolve

<issue_title>net 10 rc2 keyboard overlap android</issue_title>
<issue_description>### Description

if you have an entry at the bottom of the screen , the keyboards ovelarps it and you cannot see anything, as you can imagine we have applications where a user is asked to input lots of data and all the entries are overlapped!

Steps to Reproduce

  1. Create a page in maui .net 10 rc2
  2. Place an entry at the bottom of the screen
  3. Start typing.. and the keyboard will overlap the entry
  4. Add below to MainActivity
  5. I have attached both repo - net 9 and 10
protected override void OnCreate(Bundle? savedInstanceState)
       {
           base.OnCreate(savedInstanceState);
           Window?.SetSoftInputMode(SoftInput.AdjustResize | SoftInput.StateUnspecified);

       }
  1. Works in .net 9 but not in .net 10See below net 9 on the left and .net 10 RC2 on the right!

Image

MauiAppNe10Overlap.zip
MauiNet9Overlap.zip

Link to public reproduction project repository

No response

Version with bug

10.0.0-rc.2

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.111 SR11.1

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

none

Relevant log output

```</issue_description>

<agent_instructions>If the user has set the Android Window's SoftInput mode to AdjustResize then we should inset the top level view on the android app if the softinput is open . I'm not sure the best fix here, what we might do is set the inset listener on the container view at the top level and then pad that if the softinput is open and they've set the window to adjust resize, or we add the inset listener to the DecorView. Not sure, need to test out a few scenarios</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@jsuarezruiz</author><body>
@NirmalKumarYuvaraj I have seen Shane assigned you to review it. My thoughts:
- I think the regression comes from https://github.com/dotnet/maui/pull/31798/files
- The issue occurs because `WindowCompat.SetDecorFitsSystemWindows(Window, false)` was being called in `MauiAppCompatActivity.OnCreate()`. When set to false, this tells Android that the app will handle all window insets manually, which disables the default `SoftInput.AdjustResize` behavior.</body></comment_new>
<comment_new><author>@PureWeen</author><body>
@TedMobile as a workaround

I think you can set SafeAreaEdges on your ContentPages to "Container" and that should fix for now</body></comment_new>
<comment_new><author>@NirmalKumarYuvaraj</author><body>
@TedMobile , You can set SafeAreaEdges on your ContentPages to "All". This will fix the issue, I have attached a video reference.

https://github.com/user-attachments/assets/6d11a017-0c30-46d8-bccf-d9188329e00f

</body></comment_new>
<comment_new><author>@PureWeen</author><body>
> [@NirmalKumarYuvaraj](https://github.com/NirmalKumarYuvaraj) [@PureWeen](https://github.com/PureWeen) well, Adding SafeAreasEdges.All I have noticed that creates an overlap in iOS on many of my screens but fixes android.

do you have a repro on iOS by chance?</body></comment_new>
</comments>

💡 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.

Copilot AI changed the title [WIP] Fix keyboard overlap issue in .NET 10 RC2 Fix keyboard overlap on Android when SoftInput.AdjustResize is set Nov 5, 2025
Copilot AI requested a review from PureWeen November 5, 2025 15:30
Copilot finished work on behalf of PureWeen November 5, 2025 15:30
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.


[Test]
[Category(UITestCategories.SafeAreaEdges)]
public void VerifyKeyboardDoesNotOverlapEntryWithAdjustResize()
Copy link
Contributor

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.

Copy link
Contributor Author

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).

@NirmalKumarYuvaraj
Copy link
Contributor

@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.

Copy link
Contributor Author

Copilot AI commented Nov 6, 2025

@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.

Copilot finished work on behalf of NirmalKumarYuvaraj November 6, 2025 09:40
@github-actions github-actions bot force-pushed the copilot/improve-copilot-agent-strategies branch from c036163 to c004621 Compare November 6, 2025 22:22
Copy link
Contributor

@jsuarezruiz jsuarezruiz left a 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.

Copy link
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot Fix current conflict.

Merged main into branch in commit e93315f. The merge completed successfully with no conflicts.

Copilot AI requested a review from jsuarezruiz November 7, 2025 08:07
Copilot finished work on behalf of jsuarezruiz November 7, 2025 08:07
Base automatically changed from copilot/improve-copilot-agent-strategies to main November 7, 2025 20:00
@PureWeen
Copy link
Member

PureWeen commented Nov 8, 2025

/rebase

@PureWeen PureWeen added this to the .NET 10.0 SR1 milestone Nov 8, 2025
@PureWeen PureWeen added the p/0 Current heighest priority issues that we are targeting for a release. label Nov 8, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Nov 8, 2025
Copilot AI and others added 3 commits November 8, 2025 18:08
- Modified SafeAreaExtensions to detect window's SoftInputMode
- Apply keyboard insets when AdjustResize is set, even without SoftInput flag
- This restores the pre-regression behavior where content resizes to avoid keyboard

Co-authored-by: PureWeen <[email protected]>
- Created Issue32041.xaml test page with Entry at bottom
- Created Issue32041.xaml.cs that sets SoftInput.AdjustResize
- Created Issue32041.cs test that verifies keyboard doesn't overlap Entry

Co-authored-by: PureWeen <[email protected]>
Copilot AI and others added 3 commits November 8, 2025 18:08
Apply code review feedback to use HasFlag instead of manual bitwise comparison

Co-authored-by: PureWeen <[email protected]>
- Created Issue32041AdjustPan.xaml and code-behind for AdjustPan test
- Added VerifyAdjustPanDoesNotApplyInsets test to ensure no regression
- Verifies that with AdjustPan mode, no keyboard insets are applied

Co-authored-by: NirmalKumarYuvaraj <[email protected]>
@PureWeen PureWeen force-pushed the copilot/fix-keyboard-overlap-issue branch from e93315f to 756a5f5 Compare November 9, 2025 00:09
@PureWeen
Copy link
Member

PureWeen commented Nov 9, 2025

@copilot i have rebased this pr

can you asses if your changes on this pr still seem correct?

Copy link
Contributor Author

Copilot AI commented Nov 9, 2025

@copilot i have rebased this pr

can you asses if your changes on this pr still seem correct?

Yes, the changes are still correct after the rebase. I've verified:

Core logic intact: SafeAreaExtensions.cs properly detects SoftInputMode and applies keyboard insets when AdjustResize is set (lines 53-67, 264-265)

Tests preserved: Both test pages (Issue32041 and Issue32041AdjustPan) and test cases exist and are properly structured

Build successful: Core Android project builds without errors

Unit tests passing: All 45 SafeArea unit tests pass

6 commits intact:

  • bb5e7c1: Initial plan
  • 40c348b: Fix keyboard overlap when SoftInput.AdjustResize is set
  • da71f02: Add UI test for AdjustResize
  • 36cdc35: Apply formatting
  • 3d76cb5: Use HasFlag for readability
  • 756a5f5: Add AdjustPan test

The fix correctly restores .NET 9 behavior by applying keyboard insets when users set SoftInput.AdjustResize, regardless of SafeAreaRegions settings.

Copilot finished work on behalf of PureWeen November 9, 2025 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p/0 Current heighest priority issues that we are targeting for a release.

Projects

Status: Ready To Review

Development

Successfully merging this pull request may close these issues.

net 10 rc2 keyboard overlap android

4 participants