@@ -14,10 +14,11 @@ define([
14
14
'text!ui/template/modal/modal-slide.html' ,
15
15
'text!ui/template/modal/modal-custom.html' ,
16
16
'Magento_Ui/js/lib/key-codes' ,
17
+ 'jquery/patches/z-index' ,
17
18
'jquery-ui-modules/widget' ,
18
19
'jquery-ui-modules/core' ,
19
20
'mage/translate'
20
- ] , function ( $ , _ , template , popupTpl , slideTpl , customTpl , keyCodes ) {
21
+ ] , function ( $ , _ , template , popupTpl , slideTpl , customTpl , keyCodes , zIndex ) {
21
22
'use strict' ;
22
23
23
24
/**
@@ -39,39 +40,7 @@ define([
39
40
return transitions [ transition ] ;
40
41
}
41
42
}
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
+ } ) ( ) ;
75
44
76
45
/**
77
46
* Modal Window Widget
@@ -373,8 +342,8 @@ define([
373
342
* Set z-index and margin for modal and overlay.
374
343
*/
375
344
_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 ( ) ;
378
347
379
348
if ( this . modal . data ( 'active' ) ) {
380
349
return ;
0 commit comments