Commit f3cd39b
authored
fix(modal): remove safe-area gap and flash in fullscreen modals (#31092)
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
- [x] No
<!--
If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->
## 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:
- iOS:
https://ionic-framework-git-fw-7136-ionic1.vercel.app/src/components/modal/test/basic?ionic:mode=ios
- MD:
https://ionic-framework-git-fw-7136-ionic1.vercel.app/src/components/modal/test/basic?ionic:mode=md
Example iOS card modal safe-area:
- iOS:
https://ionic-framework-git-fw-7136-ionic1.vercel.app/src/components/modal/test/safe-area?ionic:mode=ios
## Dev Build:
```
8.8.5-dev.11776879142.101200b9
```1 parent 0db5b40 commit f3cd39b
4 files changed
Lines changed: 218 additions & 54 deletions
File tree
- core/src/components
- content
- modal
- test/safe-area
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
320 | 319 | | |
321 | 320 | | |
322 | 321 | | |
| |||
1429 | 1428 | | |
1430 | 1429 | | |
1431 | 1430 | | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
1432 | 1436 | | |
1433 | 1437 | | |
1434 | 1438 | | |
| |||
1451 | 1455 | | |
1452 | 1456 | | |
1453 | 1457 | | |
1454 | | - | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
1455 | 1462 | | |
1456 | 1463 | | |
1457 | 1464 | | |
| |||
1496 | 1503 | | |
1497 | 1504 | | |
1498 | 1505 | | |
1499 | | - | |
1500 | | - | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1501 | 1510 | | |
1502 | 1511 | | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
1506 | 1512 | | |
1507 | 1513 | | |
1508 | 1514 | | |
1509 | | - | |
1510 | | - | |
1511 | | - | |
1512 | | - | |
1513 | | - | |
1514 | | - | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
1515 | 1563 | | |
1516 | | - | |
1517 | | - | |
| 1564 | + | |
| 1565 | + | |
1518 | 1566 | | |
1519 | 1567 | | |
1520 | | - | |
| 1568 | + | |
1521 | 1569 | | |
1522 | 1570 | | |
1523 | 1571 | | |
1524 | | - | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
1529 | | - | |
1530 | | - | |
1531 | | - | |
1532 | | - | |
1533 | | - | |
1534 | | - | |
1535 | | - | |
1536 | | - | |
| 1572 | + | |
1537 | 1573 | | |
1538 | 1574 | | |
1539 | 1575 | | |
1540 | | - | |
| 1576 | + | |
1541 | 1577 | | |
1542 | 1578 | | |
1543 | 1579 | | |
1544 | 1580 | | |
1545 | 1581 | | |
1546 | 1582 | | |
1547 | 1583 | | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
| 1584 | + | |
| 1585 | + | |
1552 | 1586 | | |
1553 | 1587 | | |
1554 | 1588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
| |||
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
| |||
92 | 104 | | |
93 | 105 | | |
94 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
95 | 124 | | |
96 | 125 | | |
97 | 126 | | |
| |||
129 | 158 | | |
130 | 159 | | |
131 | 160 | | |
132 | | - | |
133 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
134 | 166 | | |
135 | 167 | | |
136 | 168 | | |
| |||
0 commit comments