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+
1215const CLASS_NON_SCROLLABLE = 'ibexa-non-scrollable' ;
1316const CLASS_MODAL_OPEN = 'modal-open' ;
1417const 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
201233Popup . defaultProps = {
@@ -211,6 +243,7 @@ Popup.defaultProps = {
211243 subtitle : null ,
212244 showTooltip : true ,
213245 subheader : null ,
246+ controlZIndex : false ,
214247} ;
215248
216249export default Popup ;
0 commit comments