modal.js: Don't try to hide a modal when there is none
Fixes a bug that when e.g. closing a color picker by clicking the escape key, also the `modal.hide()` action is performed, even though there was no real modal opened before, but it seems to react automatically on the escape key click.
This commit is contained in:
parent
6d1d60c35d
commit
a1cd7441c5
|
@ -171,7 +171,10 @@
|
|||
var _this = event.data.self;
|
||||
|
||||
if (! event.isDefaultPrevented() && event.key === 'Escape') {
|
||||
_this.hide(_this.$layout.children('#modal'));
|
||||
let $modal = _this.$layout.children('#modal');
|
||||
if ($modal.length) {
|
||||
_this.hide($modal);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue