Skip to content

fix(modal): remove safe-area gap and flash in fullscreen modals#31092

Merged
ShaneK merged 5 commits intomainfrom
FW-7136
Apr 27, 2026
Merged

fix(modal): remove safe-area gap and flash in fullscreen modals#31092
ShaneK merged 5 commits intomainfrom
FW-7136

Conversation

@ShaneK
Copy link
Copy Markdown
Member

@ShaneK ShaneK commented Apr 22, 2026

Issue number: resolves #31015


What is the current behavior?

Fullscreen modals without an ion-footer set height and padding-bottom on .modal-wrapper to reserve space for the bottom safe-area. Because ion-content's background does not extend into that wrapper padding, a visible gap appears between the content and the bottom edge of the modal.

Separately, modals that declare custom --width and --height on phone viewports flash inherited safe-area values while animating in, then snap to 0px once the post-animation position correction runs.

What is the new behavior?

Bottom safe-area compensation now happens inside ion-content instead of on the wrapper, so the modal background stays edge-to-edge.

  • New internal --ion-content-safe-area-padding-bottom CSS property is added to .inner-scroll's padding-bottom calc.
  • modal.tsx sets that property on ion-content for fullscreen modals without a footer, and clears it on resize and dismiss.
  • Wrapper no longer has height or padding-bottom inline styles written to it.
  • New hasCustomModalDimensions() helper detects modals that override both --width and --height to non-fullscreen values. These are zeroed from the initial safe-area prediction so there is no flash before the post-animation correction.
  • Extracted findContentAndFooter() and applyFullscreenSafeAreaTo() helpers so the resize handler and initial apply share the same lookup.
  • E2E tests cover scroll-padding placement, wrapper content area remaining full viewport height, .inner-scroll padding including safe-area, and custom-dimension modals starting at zero.

Does this introduce a breaking change?

  • Yes
  • No

Other information

--ion-content-safe-area-padding-bottom is an internal property. It is additive with the existing --padding-bottom consumers can set, and it only takes effect when modal.tsx writes it on fullscreen modals without a footer.

Example pages:

Example iOS card modal safe-area:

Dev Build:

8.8.5-dev.11776879142.101200b9

@ShaneK ShaneK requested a review from a team as a code owner April 22, 2026 13:31
@ShaneK ShaneK requested a review from brandyscarney April 22, 2026 13:31
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Apr 27, 2026 5:42pm

Request Review

Copy link
Copy Markdown
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

LGTM, minor suggestion

testInfo.annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/30900',
description: 'https://github.com/ionic-team/ionic-framework/issues/31015',
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.

Why was the issue changed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Old version of this test asserted on wrapperEl padding-bottom, which was the behavior #30949 added when fixing #30900. This PR moves that compensation into ion-content's scroll padding to fix #31015 (the regression #30949 caused), so the assertions now verify the #31015 fix rather than the original #30900 work. I don't think we can have two annotations at once for the same issue? Or can we? Not sure. We don't typically do that, so I just replaced this one.

}

/**
* Sets --ion-content-safe-area-padding-bottom on the given ion-content
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.

Correct me if I'm wrong but it seems that --ion-content-safe-area-padding-bottom is a a new variable to the project? If that's the case, can we comment that it's meant for internal usages and when to use it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For sure! Done: 559103a

Copy link
Copy Markdown
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

Looks good!

@ShaneK ShaneK added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit f3cd39b Apr 27, 2026
99 of 141 checks passed
@ShaneK ShaneK deleted the FW-7136 branch April 27, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: applyFullscreenSafeArea() shrinks fullscreen modal wrapper when ion-content exists without ion-footer (8.8.1 regression)

3 participants