Lose focus on any active element when dragging, resizing or opening settings

[MAILPOET-1811]
This commit is contained in:
Ján Mikláš
2019-05-20 15:47:43 +02:00
committed by Pavel Dohnal
parent ed58ad6ae0
commit 757335bce7
3 changed files with 3 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ BL.DraggableBehavior = Marionette.Behavior.extend({
that.view.$el.addClass('mailpoet_hidden'); that.view.$el.addClass('mailpoet_hidden');
} }
App.getChannel().trigger('dragStart'); App.getChannel().trigger('dragStart');
document.activeElement.blur();
} }
}, },
// call this function on every dragmove event // call this function on every dragmove event

View File

@@ -48,6 +48,7 @@ BL.ResizableBehavior = Marionette.Behavior.extend({
}) })
.on('resizestart', function resizestart() { .on('resizestart', function resizestart() {
that.view.model.trigger('startResizing'); that.view.model.trigger('startResizing');
document.activeElement.blur();
}).on('resizemove', function resizemove(event) { }).on('resizemove', function resizemove(event) {
var onResize = that.options.onResize.bind(that); var onResize = that.options.onResize.bind(that);
return onResize(event); return onResize(event);

View File

@@ -241,6 +241,7 @@ Module.BlockToolsView = AugmentedView.extend({
App.getChannel().trigger('hideSettings'); App.getChannel().trigger('hideSettings');
return; return;
} }
document.activeElement.blur();
App.getChannel().trigger('settingsDisplayed', this.model.cid); App.getChannel().trigger('settingsDisplayed', this.model.cid);
(new ViewType(_.extend({ model: this.model }, options || {}))).render(); (new ViewType(_.extend({ model: this.model }, options || {}))).render();
}, },