Skip to content

[Android] Fix popup centering when content and margins exceed layout bounds - #39561

Merged
kubaflo merged 2 commits into
dotnet:inflight/currentfrom
sheiksyedm:sheiksyedm-issue-39557-reproduction
Oct 23, 2026
Merged

kubaflo merged 2 commits into
dotnet:inflight/currentfrom
sheiksyedm:sheiksyedm-issue-39557-reproduction

Conversation

@sheiksyedm

@sheiksyedm sheiksyedm commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Fix popup alignment reported after upgrading Microsoft.Maui.Controls from 10.0.110 to 10.0.120.

The margin-overflow logic in LayoutExtensions clamps negative alignment space even when the margins themselves fit within the available bounds. When content plus margins exceeds those bounds, this suppresses the offset needed for centering and shifts the popup toward the trailing edge.

This change:

  • Restricts horizontal and vertical alignment clamping to cases where the margins consume all available space.
  • Preserves the existing large-margin correction and FlexLayout exception.
  • Adds regression coverage for Center, End, and explicitly sized Fill alignment, plus margin-overflow and FlexLayout preservation cases.

Regression PR #37080

Issues Fixed

Fixes #39557

kubaflo and others added 2 commits October 21, 2026 14:15
<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Remove the unused SDK insertion templates instead of migrating their
retired `VSEngSS-MicroBuild2022-1ES` pool:

- `eng/pipelines/common/insertion.yml`
- `eng/pipelines/common/sdk-insertion.yml`

The stage template has no callers, and the job template is referenced
only by that stage. The former `maui-release.yml` caller was removed in
dotnet#31130. The current official build uses Arcade publishing; its
configured YAML entry point and matching `main` revision were checked in
Azure DevOps. The legacy DevDiv MAUI pipeline definitions are disabled.
No active pipeline, publishing stage, or pool is changed.

**Validation:** `git diff --check` passed. PyYAML parsed all 39
remaining pipeline YAML files, and all 113 static local template
references resolved. A tracked-file search found no remaining references
to the retired pool, either deleted template, or the old `sdk_insertion`
stage. No new pipeline tests were added, and no device/UI tests were run
for this configuration-only deletion.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes dotnet#39518

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2f892844-9872-4d2f-8799-c45663efc2a3
Restrict margin-overflow clamping to margins that consume the available bounds, preserving popup centering and the existing large-margin and FlexLayout behavior.

Add horizontal and vertical alignment regression coverage for dotnet#39557.
Copilot AI balanced review requested due to automatic review settings October 22, 2026 15:53
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39561

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39561"

@azure-pipelines

This comment has been minimized.

@sheiksyedm sheiksyedm added platform/android community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Oct 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Shared cross-platform layout behavior changes without verified test execution or CI results warrant human validation.

No open issues 🎉

What changed in this PR

Addresses the Android popup-centering regression in #39557 by narrowing overflow clamping in MAUI’s shared layout helpers. The change refines the margin-placement behavior introduced by #37080 and affects alignment across platforms.

Changes:

  • Clamp horizontal and vertical alignment offsets only when margins consume all available space, retaining the existing additional checks.
  • Preserve the FlexLayout exception.
  • Add regression tests for Center, End, explicitly sized Fill, and margin-overflow behavior.
File Description
src/​Core/​tests/​UnitTests/​Layouts/​LayoutExtensionTests.cs Adds alignment regression tests and FlexLayout preservation cases.
src/​Core/​src/​Layouts/​LayoutExtensions.cs Narrows horizontal and vertical margin-overflow clamping conditions.

Review effort: Balanced

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Oct 22, 2026
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo
kubaflo changed the base branch from main to inflight/current October 23, 2026 10:01
@kubaflo
kubaflo merged commit b785db4 into dotnet:inflight/current Oct 23, 2026
201 of 213 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR13 milestone Oct 23, 2026
kubaflo added a commit that referenced this pull request Oct 24, 2026
Trace the one-pixel box shift to #39561's intentional vertical alignment correction. Preserve the product fix and all test assertions. Old clamping passes 3/3; restored production with old images fails 3/3; reviewed images pass 3/3; image revert fails 3/3; restored images pass 3/3. The only pixel changes are two box-edge rows, with no gradient differences. Existing #38843 carries the target's old pixels and does not address this later centering change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 35e8b0da-aca3-469d-8dca-b808947cbe81
kubaflo added a commit that referenced this pull request Oct 25, 2026
Trace the one-pixel box shift to #39561's intentional vertical alignment correction. Preserve the product fix and all test assertions. Old clamping passes 3/3; restored production with old images fails 3/3; reviewed images pass 3/3; image revert fails 3/3; restored images pass 3/3. The only pixel changes are two box-edge rows, with no gradient differences. Existing #38843 carries the target's old pixels and does not address this later centering change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 35e8b0da-aca3-469d-8dca-b808947cbe81
kubaflo pushed a commit that referenced this pull request Oct 25, 2026
…bounds (#39561)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!


<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

Fix popup alignment reported after upgrading Microsoft.Maui.Controls
from 10.0.110 to 10.0.120.

The margin-overflow logic in LayoutExtensions clamps negative alignment
space even when the margins themselves fit within the available bounds.
When content plus margins exceeds those bounds, this suppresses the
offset needed for centering and shifts the popup toward the trailing
edge.

This change:
- Restricts horizontal and vertical alignment clamping to cases where
the margins consume all available space.
- Preserves the existing large-margin correction and FlexLayout
exception.
- Adds regression coverage for Center, End, and explicitly sized Fill
alignment, plus margin-overflow and FlexLayout preservation cases.

Regression PR #37080

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39557

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Oct 26, 2026
Trace the one-pixel box shift to #39561's intentional vertical alignment correction. Preserve the product fix and all test assertions. Old clamping passes 3/3; restored production with old images fails 3/3; reviewed images pass 3/3; image revert fails 3/3; restored images pass 3/3. The only pixel changes are two box-edge rows, with no gradient differences. Existing #38843 carries the target's old pixels and does not address this later centering change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 35e8b0da-aca3-469d-8dca-b808947cbe81
kubaflo added a commit that referenced this pull request Oct 26, 2026
Trace the one-pixel box shift to #39561's intentional vertical alignment correction. Preserve the product fix and all test assertions. Old clamping passes 3/3; restored production with old images fails 3/3; reviewed images pass 3/3; image revert fails 3/3; restored images pass 3/3. The only pixel changes are two box-edge rows, with no gradient differences. Existing #38843 carries the target's old pixels and does not address this later centering change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 35e8b0da-aca3-469d-8dca-b808947cbe81
kubaflo pushed a commit that referenced this pull request Oct 26, 2026
…bounds (#39561)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!


<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

Fix popup alignment reported after upgrading Microsoft.Maui.Controls
from 10.0.110 to 10.0.120.

The margin-overflow logic in LayoutExtensions clamps negative alignment
space even when the margins themselves fit within the available bounds.
When content plus margins exceeds those bounds, this suppresses the
offset needed for centering and shifts the popup toward the trailing
edge.

This change:
- Restricts horizontal and vertical alignment clamping to cases where
the margins consume all available space.
- Preserves the existing large-margin correction and FlexLayout
exception.
- Adds regression coverage for Center, End, and explicitly sized Fill
alignment, plus margin-overflow and FlexLayout preservation cases.

Regression PR #37080

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39557

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Oct 26, 2026
Trace the one-pixel box shift to #39561's intentional vertical alignment correction. Preserve the product fix and all test assertions. Old clamping passes 3/3; restored production with old images fails 3/3; reviewed images pass 3/3; image revert fails 3/3; restored images pass 3/3. The only pixel changes are two box-edge rows, with no gradient differences. Existing #38843 carries the target's old pixels and does not address this later centering change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 35e8b0da-aca3-469d-8dca-b808947cbe81
github-actions Bot pushed a commit that referenced this pull request Oct 28, 2026
…bounds (#39561)

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!


<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

Fix popup alignment reported after upgrading Microsoft.Maui.Controls
from 10.0.110 to 10.0.120.

The margin-overflow logic in LayoutExtensions clamps negative alignment
space even when the margins themselves fit within the available bounds.
When content plus margins exceeds those bounds, this suppresses the
offset needed for centering and shifts the popup toward the trailing
edge.

This change:
- Restricts horizontal and vertical alignment clamping to cases where
the margins consume all available space.
- Preserves the existing large-margin correction and FlexLayout
exception.
- Adds regression coverage for Center, End, and explicitly sized Fill
alignment, plus margin-overflow and FlexLayout preservation cases.

Regression PR #37080

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39557

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 23, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 09a43acc Deployed Oct 22, 2026 by sheiksyedm via conclusion #2461
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android s/agent-review-in-progress AI review is currently running for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Popups are no longer displayed in the center of the screen.

3 participants