Skip to content

Commit 6455966

Browse files
committed
MAGETWO-87731: An error happens when you have a new Critical Admin Notification and Release Notification window is opened
1 parent 800ae03 commit 6455966

File tree

1 file changed

+12
-4
lines changed
  • app/code/Magento/Ui/view/base/web/js/modal

1 file changed

+12
-4
lines changed

app/code/Magento/Ui/view/base/web/js/modal/modal.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,12 @@ define([
336336
* Set z-index and margin for modal and overlay.
337337
*/
338338
_setActive: function () {
339-
var zIndex = this.modal.zIndex();
339+
var zIndex = this.modal.zIndex(),
340+
baseIndex = zIndex + this._getVisibleCount();
340341

342+
this.overlay.zIndex(++baseIndex);
341343
this.prevOverlayIndex = this.overlay.zIndex();
342-
this.modal.zIndex(zIndex + this._getVisibleCount());
343-
this.overlay.zIndex(zIndex + (this._getVisibleCount() - 1));
344+
this.modal.zIndex(this.overlay.zIndex() + 1);
344345

345346
if (this._getVisibleSlideCount()) {
346347
this.modal.css('marginLeft', this.options.modalLeftMargin * this._getVisibleSlideCount());
@@ -354,7 +355,14 @@ define([
354355
this.modal.removeAttr('style');
355356

356357
if (this.overlay) {
357-
this.overlay.zIndex(this.prevOverlayIndex);
358+
// In cases when one modal is closed but there is another modal open (e.g. admin notifications)
359+
// to avoid collisions between overlay and modal zIndexes
360+
// overlay zIndex is set to be less than modal one
361+
if (this._getVisibleCount() === 1) {
362+
this.overlay.zIndex(this.prevOverlayIndex - 1);
363+
} else {
364+
this.overlay.zIndex(this.prevOverlayIndex);
365+
}
358366
}
359367
},
360368

0 commit comments

Comments
 (0)