Repository navigation
[Android] SafeArea: let empty insets reach tracked views so SoftInput padding resets - #39672
Conversation
… padding resets MauiWindowInsetListener returned early on !HasInsets, so on a window with no system bars the dispatch that follows the keyboard closing never reached the view still carrying keyboard-height padding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39672Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39672" |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey there @@kevin68! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey there @kevin68! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit 75bbaa8.
PR Test Gate🧪 Gate analysis — click to expand✅ Passed. The selected verification satisfied the gate's passing conditions. Unmatched, skipped, or inconclusive groups are not passing evidence. 📱 Device tests
Execution log excerptsWithout fix With fix PR head: 75bbaa8b. Without-fix baseline: 4781afbd. |
… padding resets (#39672) ### Description of Change `MauiWindowInsetListener.OnApplyWindowInsets` returned early on `!insets.HasInsets`, before the view's `IHandleWindowInsets` handler. When the keyboard closes on a window with no system bars, every inset is zero. A view that still carries keyboard-height padding, and is therefore tracked, never got the dispatch that resets it, so the padding stayed for good. The early return now applies only to views the listener does not track. A view with no applied padding has nothing to reset, so the existing short-circuit still saves it the work. A tracked view receives the empty insets, and `SafeAreaExtensions.ApplyAdjustedSafeAreaInsetsPx` already resets its padding to 0: a tracked view with every edge at 0 goes on to `SetPadding(0, 0, 0, 0)`. The `IsImeAnimating` gate is unchanged. During an animation, tracked views are still gated and get their settled insets from the end-of-animation re-apply, which this change now lets through. ### Tests `MauiWindowInsetListenerTests.EmptyInsetsReachTrackedViewsOnly` (Android device test) checks two things: - empty insets reach a tracked view's handler; - they are still skipped for an untracked one. I ran the `Category=Window` device tests on a Samsung Galaxy Tab A11 (SM-X230, Android 16, API 36): - with the fix: 41/41 pass, all 7 `MauiWindowInsetListenerTests` included; - without the fix: `EmptyInsetsReachTrackedViewsOnly` fails (`Expected: 1, Actual: 0`), and every other test passes. ### Issues Fixed Fixes #39671
Description of Change
MauiWindowInsetListener.OnApplyWindowInsetsreturned early on!insets.HasInsets, before the view'sIHandleWindowInsetshandler. When the keyboard closes on a window with no system bars, every inset is zero. A view that still carries keyboard-height padding, and is therefore tracked, never got the dispatch that resets it, so the padding stayed for good.The early return now applies only to views the listener does not track. A view with no applied padding has nothing to reset, so the existing short-circuit still saves it the work. A tracked view receives the empty insets, and
SafeAreaExtensions.ApplyAdjustedSafeAreaInsetsPxalready resets its padding to 0: a tracked view with every edge at 0 goes on toSetPadding(0, 0, 0, 0).The
IsImeAnimatinggate is unchanged. During an animation, tracked views are still gated and get their settled insets from the end-of-animation re-apply, which this change now lets through.Tests
MauiWindowInsetListenerTests.EmptyInsetsReachTrackedViewsOnly(Android device test) checks two things:I ran the
Category=Windowdevice tests on a Samsung Galaxy Tab A11 (SM-X230, Android 16, API 36):MauiWindowInsetListenerTestsincluded;EmptyInsetsReachTrackedViewsOnlyfails (Expected: 1, Actual: 0), and every other test passes.Issues Fixed
Fixes #39671
🤖 Generated with Claude Code