@@ -69,8 +69,10 @@ const getModalMaxZIndex = () => {
69
69
const getModalZIndexOffset = ( ) => getComponentConfig ( NAME , 'zIndexOffset' )
70
70
71
71
// Returns the next z-index to be used by a modal to ensure proper
72
- // stacking regardless of document order
73
- const getModalNextZIndex = ( ) => getModalMaxZIndex ( ) + getModalZIndexOffset ( )
72
+ // stacking regardless of document order.
73
+ // The first modal open will be given a z-index of 0
74
+ const getModalNextZIndex = ( ) =>
75
+ getModalOpenCount ( ) === 0 ? 0 : getModalMaxZIndex ( ) + getModalZIndexOffset ( )
74
76
75
77
// @vue /component
76
78
export default {
@@ -336,8 +338,8 @@ export default {
336
338
]
337
339
} ,
338
340
modalOuterStyle ( ) {
341
+ // Styles needed for proper stacking of modals
339
342
return {
340
- // We only set these styles on the stacked modals (z-index > 0)
341
343
position : 'absolute' ,
342
344
zIndex : this . zIndex
343
345
}
@@ -442,13 +444,22 @@ export default {
442
444
}
443
445
this . is_closing = true
444
446
const hideEvt = new BvEvent ( 'hide' , {
447
+ // BvEvent standard properties
445
448
cancelable : true ,
446
449
vueTarget : this ,
447
450
target : this . $refs . modal ,
448
- modalId : this . safeId ( ) ,
449
451
// This could be the trigger element/component reference
450
452
relatedTarget : null ,
451
- isOK : trigger || null ,
453
+ // Modal specific properties and methods
454
+ modalId : this . safeId ( ) ,
455
+ // `isOK` should be deprecated:
456
+ // isOK: {
457
+ // get() {
458
+ // warn(`b-modal: evt.isOK is deprecated. Please check evt.trigger === 'ok'`)
459
+ // return trigger === 'ok'
460
+ // }
461
+ // }
462
+ isOK : trigger === 'ok' ,
452
463
trigger : trigger || null ,
453
464
cancel ( ) /* istanbul ignore next */ {
454
465
// Backwards compatibility
@@ -556,7 +567,7 @@ export default {
556
567
this . setEnforceFocus ( false )
557
568
this . $nextTick ( ( ) => {
558
569
this . is_hidden = this . lazy || false
559
- this . zIndex = getModalZIndexOffset ( )
570
+ this . zIndex = 0
560
571
this . returnFocusTo ( )
561
572
this . is_closing = false
562
573
const hiddenEvt = new BvEvent ( 'hidden' , {
0 commit comments