File tree 2 files changed +17
-14
lines changed
core/services/interimElement
2 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -409,7 +409,7 @@ function MdDialogProvider($$interimElementProvider) {
409
409
var computeFrom = ( options . parent [ 0 ] == $document [ 0 ] . body && $document [ 0 ] . documentElement
410
410
&& $document [ 0 ] . scrollTop ) ? angular . element ( $document [ 0 ] . documentElement ) : options . parent ;
411
411
var parentOffset = computeFrom . prop ( 'scrollTop' ) ;
412
- options . backdrop = angular . element ( '<md-backdrop class="md-dialog-backdrop md-opaque">' ) ;
412
+ options . backdrop = angular . element ( '<md-backdrop class="md-dialog-backdrop md-opaque" style="z-index: ' + options . zIndex + '" >') ;
413
413
$mdTheming . inherit ( options . backdrop , options . parent ) ;
414
414
$animate . enter ( options . backdrop , options . parent ) ;
415
415
element . css ( 'top' , parentOffset + 'px' ) ;
@@ -429,7 +429,9 @@ function MdDialogProvider($$interimElementProvider) {
429
429
if ( options . escapeToClose ) {
430
430
options . rootElementKeyupCallback = function ( e ) {
431
431
if ( e . keyCode === $mdConstant . KEY_CODE . ESCAPE ) {
432
- $timeout ( $mdDialog . cancel ) ;
432
+ if ( options . stack . indexOf ( options . interimElement ) == 0 ) {
433
+ $timeout ( $mdDialog . cancel ) ;
434
+ }
433
435
}
434
436
} ;
435
437
$rootElement . on ( 'keyup' , options . rootElementKeyupCallback ) ;
Original file line number Diff line number Diff line change @@ -258,17 +258,12 @@ function InterimElementProvider() {
258
258
*
259
259
*/
260
260
function show ( options ) {
261
- if ( stack . length ) {
262
- return service . cancel ( ) . then ( function ( ) {
263
- return show ( options ) ;
264
- } ) ;
265
- } else {
266
- var interimElement = new InterimElement ( options ) ;
267
- stack . push ( interimElement ) ;
268
- return interimElement . show ( ) . then ( function ( ) {
269
- return interimElement . deferred . promise ;
270
- } ) ;
271
- }
261
+ options . zIndex = 80 + stack . length ;
262
+ var interimElement = new InterimElement ( options ) ;
263
+ stack . unshift ( interimElement ) ;
264
+ return interimElement . show ( ) . then ( function ( ) {
265
+ return interimElement . deferred . promise ;
266
+ } ) ;
272
267
}
273
268
274
269
/*
@@ -336,7 +331,7 @@ function InterimElementProvider() {
336
331
options . template = processTemplate ( options . template ) ;
337
332
}
338
333
339
- return self = {
334
+ self = {
340
335
options : options ,
341
336
deferred : $q . defer ( ) ,
342
337
show : function ( ) {
@@ -371,6 +366,7 @@ function InterimElementProvider() {
371
366
if ( ! options . parent . length ) options . parent = $rootElement ;
372
367
}
373
368
369
+ element . css ( 'z-index' , options . zIndex ) ;
374
370
if ( options . themable ) $mdTheming ( element ) ;
375
371
var ret = options . onShow ( options . scope , element , options ) ;
376
372
return $q . when ( ret )
@@ -404,6 +400,11 @@ function InterimElementProvider() {
404
400
} ) ;
405
401
}
406
402
} ;
403
+
404
+ options . interimElement = self ;
405
+ options . stack = stack ;
406
+
407
+ return self ;
407
408
}
408
409
} ;
409
410
You can’t perform that action at this time.
0 commit comments