Skip to content

Commit 05a4fa2

Browse files
committed
IBX-11029: Fixed z-indexes
1 parent 7702d93 commit 05a4fa2

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/bundle/Resources/public/scss/ui/modules/muti-file-upload/_upload.popup.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.c-upload-popup {
22
background: rgba($ibexa-color-black, 0.35);
33
position: fixed;
4-
z-index: 10100;
4+
z-index: 10250;
55
top: 0;
66
left: 0;
77
height: 100vh;

src/bundle/ui-dev/src/modules/common/popup/popup.component.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import {
99
getRootDOMElement,
1010
} from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
1111

12+
const MODAL_Z_INDEX = 10260;
13+
const MODAL_BACKDROP_Z_INDEX = 10250;
14+
1215
const CLASS_NON_SCROLLABLE = 'ibexa-non-scrollable';
1316
const CLASS_MODAL_OPEN = 'modal-open';
1417
const MODAL_CONFIG = {
@@ -37,6 +40,7 @@ const Popup = ({
3740
extraClasses,
3841
showTooltip,
3942
subheader,
43+
controlZIndex,
4044
}) => {
4145
const rootDOMElement = getRootDOMElement();
4246
const modalRef = useRef(null);
@@ -56,6 +60,33 @@ const Popup = ({
5660
latestBootstrapModal.current.hide();
5761
}
5862
}
63+
64+
const modalNode = modalRef.current;
65+
const modalBackdrop = document.querySelector('.modal-backdrop');
66+
67+
if (!modalBackdrop || !modalNode || !controlZIndex) {
68+
return;
69+
}
70+
71+
const backdropInitialZIndex = modalBackdrop.style.zIndex;
72+
const modalInitialZIndex = modalNode.style.zIndex;
73+
74+
modalBackdrop.style.zIndex = MODAL_BACKDROP_Z_INDEX;
75+
modalNode.style.zIndex = MODAL_Z_INDEX;
76+
77+
return () => {
78+
if (backdropInitialZIndex) {
79+
modalBackdrop.style.zIndex = backdropInitialZIndex;
80+
} else {
81+
modalBackdrop.style.removeProperty('z-index');
82+
}
83+
84+
if (modalInitialZIndex) {
85+
modalNode.style.zIndex = modalInitialZIndex;
86+
} else {
87+
modalNode.style.removeProperty('z-index');
88+
}
89+
};
5990
}, [isVisible]);
6091

6192
useEffect(() => {
@@ -196,6 +227,7 @@ Popup.propTypes = {
196227
extraClasses: PropTypes.string,
197228
showTooltip: PropTypes.bool,
198229
subheader: PropTypes.node,
230+
controlZIndex: PropTypes.bool,
199231
};
200232

201233
Popup.defaultProps = {
@@ -211,6 +243,7 @@ Popup.defaultProps = {
211243
subtitle: null,
212244
showTooltip: true,
213245
subheader: null,
246+
controlZIndex: false,
214247
};
215248

216249
export default Popup;

0 commit comments

Comments
 (0)