Skip to content

Fix Popup Padding Regression Introduced in v14.0.0#3074

Merged
TheCodeTraveler merged 11 commits intomainfrom
Fix-Popup-Margin-and-Padding
Feb 8, 2026
Merged

Fix Popup Padding Regression Introduced in v14.0.0#3074
TheCodeTraveler merged 11 commits intomainfrom
Fix-Popup-Margin-and-Padding

Conversation

@TheCodeTraveler
Copy link
Copy Markdown
Collaborator

@TheCodeTraveler TheCodeTraveler commented Feb 8, 2026

Description of Change

This PR fixes three problems:

  1. In PopupPage, use value.IsEmpty || value.IsNaN instead of value == default for PopupPage.PaddingConverter
    • For certain elements, like Button, the value of its Padding will be NaN until the View has been laid out on the screen
    • We now ensure that our converters check for both NaN and Thickness.Zero
  2. In Popup, remove [BindableProperty] from Padding, passthrough its value to the underlying ContentView.Padding property
    • The Popup.Padding property is used for the Popup's Padding between itself and the PopupBorder which maintains how ContentView implements Padding; we don't need to override its functionality
    • We keep the new keyword on the Popup.Padding property to override the XML comments to explain to the developer how we are using Popup.Padding under the hood, passing through its value to the underlying ContentView.Padding property
    • In comparison, we keep [BindableProperty] on Popup.Margin, Popup.HorizontalOptions and Popup.VerticalOptions because these values do not propagate to the underlying ContentView, rather, we use these properties to assign PopupBorder.Margin, PopupBorder.HoriztonalOptions and PopupBorder.VerticalOptions respectively
    • I've added new unit tests to DefaultPopupSettingsTests that demonstrate this usage
  3. In Popup, remove default property initializers
    • Move initialization to constructor

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard

Additional information

@TheCodeTraveler TheCodeTraveler changed the title Fix popup margin and padding Fix Popup Padding Regression Introduced in v14.0.0 Feb 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR targets regressions/edge-cases in Popup default layout behavior (margin/padding) and updates unit tests to validate default popup settings propagation when showing popups via IPopupService.

Changes:

  • Update PopupPage margin/padding converters to treat “unset” thickness values as empty/NaN and fall back to Options.DefaultPopupSettings.
  • Refactor Popup.Padding to pass through to the underlying ContentView.Padding (and remove [BindableProperty] + initializer duplication).
  • Extend unit tests to cover default popup settings behavior through IPopupService scenarios.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs Adjusts margin/padding converter logic for default fallback behavior.
src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs Refactors default initialization and changes Padding to pass through to base ContentView.
src/CommunityToolkit.Maui.UnitTests/Views/Popup/DefaultPopupSettingsTests.cs Adds/updates tests validating default popup settings via popup service and view-wrapping behavior.
src/CommunityToolkit.Maui.UnitTests/BaseViewTest.cs Registers an additional transient popup view used by the new tests.

@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) February 8, 2026 05:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Copilot AI review requested due to automatic review settings February 8, 2026 08:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

@TheCodeTraveler TheCodeTraveler merged commit e30c1f9 into main Feb 8, 2026
10 checks passed
@TheCodeTraveler TheCodeTraveler deleted the Fix-Popup-Margin-and-Padding branch February 8, 2026 18:29
@github-actions github-actions bot locked and limited conversation to collaborators Feb 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Regression in 14.0.0: DefaultPopupSettings Broken for Padding

3 participants