You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Popup on iOS has extra vertical margins #2577
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
VerticalOptions set to End:
Android
iOS
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):
Steps To Reproduce
Create a new Popup
Set its VerticalOptions to Fill
Set it's Size to 5000 (a large value that will surely go outside of the screen's bounds)
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
@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!
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)
Activity
kolodiichyk commentedon Mar 29, 2025
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
mduchev commentedon Mar 29, 2025
@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
OverFullScreenvalue, 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!bijington commentedon Mar 29, 2025
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)