@@ -14,10 +14,11 @@ define([
1414 'text!ui/template/modal/modal-slide.html' ,
1515 'text!ui/template/modal/modal-custom.html' ,
1616 'Magento_Ui/js/lib/key-codes' ,
17+ 'jquery/patches/z-index' ,
1718 'jquery-ui-modules/widget' ,
1819 'jquery-ui-modules/core' ,
1920 'mage/translate'
20- ] , function ( $ , _ , template , popupTpl , slideTpl , customTpl , keyCodes ) {
21+ ] , function ( $ , _ , template , popupTpl , slideTpl , customTpl , keyCodes , zIndex ) {
2122 'use strict' ;
2223
2324 /**
@@ -39,39 +40,7 @@ define([
3940 return transitions [ transition ] ;
4041 }
4142 }
42- } ) ( ) ,
43-
44- /**
45- * Implementation of zIndex used from jQuery UI
46- * @param {Element } elem
47- * @private
48- */
49- getZIndex = function ( elem ) {
50- var position , zIndex ;
51-
52- /* eslint-disable max-depth */
53- while ( elem . length && elem [ 0 ] !== document ) {
54- // Ignore z-index if position is set to a value where z-index is ignored by the browser
55- // This makes behavior of this function consistent across browsers
56- // WebKit always returns auto if the element is positioned
57- position = elem . css ( 'position' ) ;
58-
59- if ( position === 'absolute' || position === 'relative' || position === 'fixed' ) {
60- // IE returns 0 when zIndex is not specified
61- // other browsers return a string
62- // we ignore the case of nested elements with an explicit value of 0
63- zIndex = parseInt ( elem . css ( 'zIndex' ) , 10 ) ;
64-
65- if ( ! isNaN ( zIndex ) && zIndex !== 0 ) {
66- return zIndex ;
67- }
68- }
69- elem = elem . parent ( ) ;
70- }
71-
72- return 0 ;
73- /* eslint-enable max-depth */
74- } ;
43+ } ) ( ) ;
7544
7645 /**
7746 * Modal Window Widget
@@ -373,8 +342,8 @@ define([
373342 * Set z-index and margin for modal and overlay.
374343 */
375344 _setActive : function ( ) {
376- var zIndex = getZIndex ( this . modal ) ,
377- baseIndex = zIndex + this . _getVisibleCount ( ) ;
345+ var zIndexValue = zIndex . getValue ( this . modal ) ,
346+ baseIndex = zIndexValue + this . _getVisibleCount ( ) ;
378347
379348 if ( this . modal . data ( 'active' ) ) {
380349 return ;
0 commit comments