Skip to content

Commit b641fe6

Browse files
fix(ui5-navigation-layout): resolve mobile phone display issues in landscape mode (#12900)
* fix(ui5-navigation-layout): resolve display issues in phone landscape mode * chore: improve docs * chore: adress code comments
1 parent 66ed600 commit b641fe6

2 files changed

Lines changed: 36 additions & 4 deletions

File tree

packages/fiori/src/NavigationLayout.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement
33
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
44
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
55
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
6+
import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
67
import NavigationLayoutMode from "./types/NavigationLayoutMode.js";
78
import type SideNavigation from "./SideNavigation.js";
89

@@ -28,9 +29,9 @@ const SCREEN_WIDTH_BREAKPOINT = 600;
2829
*
2930
* ### Responsive Behavior
3031
*
31-
* On larger screens (screen width of 600px or more), the side navigation is visible
32+
* On larger screens with a width of 600px or more, excluding mobile phone devices, the side navigation is visible
3233
* by default and can be expanded or collapsed using the `mode` property.
33-
* On small screens (screen width of 599px or less), the side navigation is hidden by
34+
* On mobile phone devices and screens with a width of 599px or less, the side navigation is hidden by
3435
* default and can be displayed using the `mode` property.
3536
*
3637
* ### ES6 Module Import
@@ -63,14 +64,20 @@ class NavigationLayout extends UI5Element {
6364
* @private
6465
*/
6566
@property({ type: Boolean })
66-
sideCollapsed : boolean = window.innerWidth < SCREEN_WIDTH_BREAKPOINT;
67+
sideCollapsed : boolean = isPhone() || window.innerWidth < SCREEN_WIDTH_BREAKPOINT;
6768

6869
/**
6970
* @private
7071
*/
7172
@property({ type: Boolean })
7273
hasSideNavigation = false;
7374

75+
/**
76+
* @private
77+
*/
78+
@property({ type: Boolean })
79+
isPhone = isPhone();
80+
7481
/**
7582
* Gets whether the side navigation is collapsed.
7683
* @public
@@ -114,7 +121,7 @@ class NavigationLayout extends UI5Element {
114121

115122
calcSideCollapsed() {
116123
if (this.mode === NavigationLayoutMode.Auto) {
117-
this.sideCollapsed = window.innerWidth < SCREEN_WIDTH_BREAKPOINT;
124+
this.sideCollapsed = isPhone() || window.innerWidth < SCREEN_WIDTH_BREAKPOINT;
118125
} else {
119126
this.sideCollapsed = this.mode === NavigationLayoutMode.Collapsed;
120127
}

packages/fiori/src/themes/NavigationLayout.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,28 @@
6464
transform: translateX(100%);
6565
}
6666
}
67+
68+
:host([is-phone]) .ui5-nl-aside {
69+
position: absolute;
70+
top: 0;
71+
left: 0;
72+
bottom: 0;
73+
width: 100%;
74+
}
75+
76+
:host([is-phone]) ::slotted([ui5-side-navigation][slot="sideContent"]) {
77+
width: 100%;
78+
box-shadow: none;
79+
}
80+
81+
:host([side-collapsed][is-phone]) .ui5-nl-aside {
82+
transform: translateX(-100%);
83+
}
84+
85+
:host([side-collapsed][is-phone]) :dir(rtl) .ui5-nl-aside {
86+
transform: translateX(100%);
87+
}
88+
89+
:host([has-side-navigation]) ::slotted([ui5-shellbar][slot="header"]) {
90+
padding-inline: 0.875rem 1rem;
91+
}

0 commit comments

Comments
 (0)