Skip to content

[BUG] Popup on iOS has extra vertical margins #2577

Closed

Description

@mduchev

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When showing a popup on iOS with VerticalOptions to Fill, there are both top & bottom margins surrounding the Popup view.

VerticalOptions set to Fill:

Android iOS
Image Image

VerticalOptions set to End:

Android iOS
Image Image

Expected Behavior

I understand that from the viewpoint of operability on iOS, the outer margin of the Popup cannot be completely set to 0, so that the popup can be closed when the outer area is tapped. However, we should have an option to disable one of the 2 margins - e.g., one might want to have a popup that is with HeightRequest 100 (not occupying the fill height of the phone) which is located at the bottom edge of the phone.

The expected behavior should be the same as the current Android implementation (no bottom margin on this popup):
Image

Steps To Reproduce

  1. Create a new Popup
  2. Set its VerticalOptions to Fill
  3. Set it's Size to 5000 (a large value that will surely go outside of the screen's bounds)
  4. Show the popup

Another repro is:

  1. Create a new Popup
  2. Set its VerticalOptions to End
  3. Set it's Size to 300 (a small value)
  4. Show the popup

Link to public reproduction project repository

https://github.com/mduchev/PopupBottomMargin

Environment

- .NET MAUI CommunityToolkit: 11.1.0
- OS: macOS
- .NET MAUI: 9.0.40

Anything else?

No response

Activity

  1. kolodiichyk commented on Mar 29, 2025

    @kolodiichyk

    Hey @mduchev,

    It's not a bug. In CommunityToolkit.Popup for iOS, they are using UIModalPresentationStyle.Popover for displaying modal views, which doesn't overlay the safe area by design. This behaviour aligns with Apple's Human Interface Guidelines for popovers, which are intended to be contextual elements that respect the device's safe areas and layout margins. To fix this issue and make the popup overlay the safe area, you would need to modify the implementation to use UIModalPresentationStyle.OverFullScreen instead. Or use something like this Mopups

  2. mduchev commented on Mar 29, 2025

    @mduchev
    Author

    @kolodiichyk Be that as it may, we can change this to a feature request then. Currently, AFAIK, this behavior isn't well documented and can be a bit confusing when someone expects the popup to behave in a certain way (especially taking a look at the Android equivalent). Still, I think that giving us the option to modify the default behavior is a must. I've tried to use the OverFullScreen value, but I couldn't figure out the best place to put it. I'll try again in different stages/places in the PopupHandler that the Toolkit is exposing. Thanks for the suggestion!

  3. bijington commented on Mar 29, 2025

    @bijington
    Contributor

    For what it's worth the underlying implementation for Popups will be changing when this PR merges #1581. It will be using ContentPage and therefore you can probably just control this through the standard way (I.e. UseSafeAreaInsets)

  4. locked and limited conversation to collaborators on May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions