Skip to content

Commit a38b605

Browse files
authored
fix(ui5-responsive-popover): set z-index on phone (#1303)
**Issue** - when a component, that opens a dialog on phone, such as Select, DatePicker, ComboBox, MultiComboBox is opened within Dialog, it remains invisible, because the Dialog remains on top. - when such component opens a dialog on phone, all icons on the page are visible, but should not **Solution** set z-index on the ui5-responsive-popover tag (on desktop it relies on the ui5-popover to handle that)
1 parent 85f01d7 commit a38b605

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

packages/main/src/ResponsivePopover.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
22
import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
3+
import { getNextZIndex } from "./popup-utils/PopupUtils.js";
34
import ResponsivePopoverTemplate from "./generated/templates/ResponsivePopoverTemplate.lit.js";
45
import Popover from "./Popover.js";
56
import Dialog from "./Dialog.js";
@@ -98,6 +99,7 @@ class ResponsivePopover extends Popover {
9899

99100
this.openBy(opener);
100101
} else {
102+
this.style.zIndex = getNextZIndex();
101103
this._dialog.open();
102104
}
103105
}

packages/main/test/pages/Dialog.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
show-exceeded-text>
3434
</ui5-textarea>
3535
<ui5-select id="mySelect">
36-
<ui5-option selected>Cozy</ui5-option>
37-
<ui5-option selected>Compact</ui5-option>
36+
<ui5-option >Cozy</ui5-option>
37+
<ui5-option >Compact</ui5-option>
3838
<ui5-option selected>Condensed</ui5-option>
3939
</ui5-select>
4040
<div slot="footer" style="display: flex; align-items: center;padding: 0.25rem 0.5rem">

packages/main/test/pages/Popover.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<html style="height: 100%">
33

44
<head>
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6-
<meta charset="utf-8">
7-
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
88
<title>Popover</title>
99

1010
<script data-ui5-config type="application/json">

packages/main/test/pages/ResponsivePopover.html

+25
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,28 @@
7272
</div>
7373
</ui5-responsive-popover>
7474

75+
<h2> Inputs based component that opens popover/dialog within dialog</h2>
76+
<ui5-button id="btnOpenDialog" design="Emphasized" icon="employee">Open Dialog</ui5-button>
77+
<ui5-dialog id="dialog" header-text="Dialog" stretch>
78+
<ui5-select id="mySelect">
79+
<ui5-option >Cozy</ui5-option>
80+
<ui5-option >Compact</ui5-option>
81+
<ui5-option selected>Condensed</ui5-option>
82+
</ui5-select>
83+
<ui5-combobox>
84+
<ui5-cb-item text="Algeria"></ui5-cb-item>
85+
<ui5-cb-item text="Argentina"></ui5-cb-item>
86+
<ui5-cb-item text="Australia"></ui5-cb-item>
87+
</ui5-combobox>
88+
<ui5-multi-combobox>
89+
<ui5-mcb-item text="Cosy"></ui5-mcb-item>
90+
<ui5-mcb-item text="Compact"></ui5-mcb-item>
91+
<ui5-mcb-item text="Condensed"></ui5-mcb-item>
92+
<ui5-mcb-item text="Longest word in the world"></ui5-mcb-item>
93+
</ui5-multi-combobox>
94+
<ui5-datepicker></ui5-datepicker>
95+
</ui5-dialog>
96+
7597
<script>
7698
btnOpen.addEventListener("click", function(event) {
7799
respPopover.open(btnOpen);
@@ -93,6 +115,9 @@
93115
btnClose3.addEventListener("click", function(event) {
94116
respPopover3.close();
95117
});
118+
btnOpenDialog.addEventListener('click', function (event) {
119+
dialog.open();
120+
});
96121
</script>
97122
</body>
98123
</html>

0 commit comments

Comments
 (0)