Repository navigation
Conversation
Sheet modals always set --ion-safe-area-left and --ion-safe-area-right to 0px, so toolbars inside a full-width sheet lost their notch padding in landscape. Sheets now keep the horizontal insets when their rendered width spans the viewport, and re-evaluate them on resize.
|
@akysil is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: resolves #31818
What is the current behavior?
A sheet modal always sets
--ion-safe-area-leftand--ion-safe-area-rightto0pxon theion-modalhost, even when the sheet spans the full width of the viewport (phones). On a phone in landscape, theion-toolbarinside the sheet loses its horizontal safe-area padding, so buttons inslot="start"/slot="end"sit under the notch. The values are never re-evaluated after presentation, so resizing with the sheet open doesn't fix them either.What is the new behavior?
inherit) when their rendered wrapper spans the viewport width, and keep0pxwhen it doesn't (the centered 600px sheet on tablets, or a sheet clamped by--max-width).topstays0pxandbottomstaysinherit.onWindowResize()re-evaluates the horizontal insets for sheet modals, so a sheet that reaches the left/right edges after a resize picks up the insets.modal/test/safe-area: full-width sheet on a landscape phone (toolbar reads the root insets), max-width-clamped sheet, and the resize case.Approach
getInitialSafeAreaConfig()already receives the modal's covered axes, but the sheet branch ignored them. Sheets use the wrapper measurement (measureCoveredAxes()) rather thangetModalCoveredAxes(), because the latter treats a modal whose--widthand--heightare both fullscreen values as covering the viewport without measuring, even when--max-widthkeeps it clear of the edges. Always inheriting the horizontal insets would pad centered sheets, and moving sheets intoupdateSafeAreaOverrides()would re-measure after every animation and DOM move.Does this introduce a breaking change?
Other information
Reproduction: the issue's code reproduction, or
core/src/components/modal/test/safe-areawith--ion-safe-area-left/right: 47pxon:rootand a landscape phone viewport.Sheet modal on a landscape phone (844×390, iOS mode) with 47px left/right safe-area insets, marked by the dashed boxes, cropped to the sheet's header.
Before (main at e890307): the Close button runs into the right inset.
After (this branch): the Close button ends clear of the right inset.
Known limitations / follow-ups:
getInitialSafeAreaConfig()also hard-codesleft/rightto0px; not changed here, since the issue only covers sheets.