Skip to content

Commit e0542a7

Browse files
authored
fix(menu): remove app dir from safe area padding (#28123)
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The `--ion-safe-area-left` and `--ion-safe-area-right` variables in `ion-menu` are being set as if they use the app's direction. It's been determined that safe area is not logical and uses the device's direction. The current implementation is adding padding in the wrong sides for `ion-toolbar` and `ion-content` within a `ion-menu`. Additionally, `ion-menu` does not use the entire screen so the safe area only needs to be applied to the side that is touching the device screen. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Set the `--ion-safe-area-left` and `--ion-safe-area-right` variables to the correct values based on the device's direction. - Padding is only added to the side that is not in the safe area. - `ion-toolbar` is adding `--ion-safe-area-left` and `--ion-safe-area-right` based on the device's direction. - `ion-toolbar` can now inherit the correct values from `--ion-safe-area-left` and `--ion-safe-area-right`. - `ion-content` can now inherit the correct values from `--ion-safe-area-left` and `--ion-safe-area-right`. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: 7.3.4-dev.11694015543.18bc484f
1 parent 4b4ad75 commit e0542a7

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

core/src/components/menu/menu.scss

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,73 @@
5959
}
6060

6161
:host(.menu-side-start) .menu-inner {
62+
/**
63+
* Menu does not cover the whole screen so we need to set the safe area for the
64+
* side that touches the screen edge only. Since safe area is not logical, it
65+
* needs to be applied to the correct side depending on the language direction.
66+
* Otherwise, the content will have less space on both sides.
67+
*
68+
* LTR:
69+
* The left side of the menu touches the screen edge. The safe area padding has
70+
* already been set in the core styles, so there's no need to set it again.
71+
* The right side of the menu is not touching the screen edge. Padding is not
72+
* applied to the right side of the menu. A value of 0 is set.
73+
*/
6274
--ion-safe-area-right: 0px;
6375

6476
@include position(0, auto, 0, 0);
77+
78+
@include rtl() {
79+
/**
80+
* Menu does not cover the whole screen so we need to set the safe area for the
81+
* side that touches the screen edge only. Since safe area is not logical, it
82+
* needs to be applied to the correct side depending on the language direction.
83+
* Otherwise, the content will have less space on both sides.
84+
*
85+
* RTL:
86+
* The right side of the menu touches the screen edge. The safe area padding has
87+
* already been set in the core styles, so there's no need to set it again.
88+
* The left side of the menu is not touching the screen edge. Padding is not
89+
* applied to the left side of the menu. A value of 0 is set.
90+
*/
91+
--ion-safe-area-right: env(safe-area-inset-right);
92+
--ion-safe-area-left: 0px;
93+
}
6594
}
6695

6796
:host(.menu-side-end) .menu-inner {
97+
/**
98+
* Menu does not cover the whole screen so we need to set the safe area for the
99+
* side that touches the screen edge only. Since safe area is not logical, it
100+
* needs to be applied to the correct side depending on the language direction.
101+
* Otherwise, the content will have less space on both sides.
102+
*
103+
* LTR:
104+
* The right side of the menu touches the screen edge. The safe area padding has
105+
* already been set in the core styles, so there's no need to set it again.
106+
* The left side of the menu is not touching the screen edge. Padding is not
107+
* applied to the left side of the menu. A value of 0 is set.
108+
*/
68109
--ion-safe-area-left: 0px;
69110

70111
@include position(0, 0, 0, auto);
112+
113+
@include rtl() {
114+
/**
115+
* Menu does not cover the whole screen so we need to set the safe area for the
116+
* side that touches the screen edge only. Since safe area is not logical, it
117+
* needs to be applied to the correct side depending on the language direction.
118+
* Otherwise, the content will have less space on both sides.
119+
*
120+
* RTL:
121+
* The left side of the menu touches the screen edge. The safe area padding has
122+
* already been set in the core styles, so there's no need to set it again.
123+
* The right side of the menu is not touching the screen edge. Padding is not
124+
* applied to the right side of the menu. A value of 0 is set.
125+
*/
126+
--ion-safe-area-left: env(safe-area-inset-left);
127+
--ion-safe-area-right: 0px;
128+
}
71129
}
72130

73131
ion-backdrop {

core/src/components/toolbar/toolbar.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@
2828
--opacity-scale: 1;
2929

3030
@include font-smoothing();
31-
@include padding-horizontal(var(--ion-safe-area-left), var(--ion-safe-area-right));
3231

3332
display: block;
3433

3534
position: relative;
3635

3736
width: 100%;
3837

38+
// stylelint-disable-next-line property-disallowed-list
39+
padding-right: var(--ion-safe-area-right);
40+
// stylelint-disable-next-line property-disallowed-list
41+
padding-left: var(--ion-safe-area-left);
42+
3943
color: var(--color);
4044

4145
font-family: $font-family-base;

0 commit comments

Comments
 (0)