diff --git a/src/core.js b/src/core.js index 1d9ebfafbe1..35c308cd314 100644 --- a/src/core.js +++ b/src/core.js @@ -1170,12 +1170,6 @@ Handsontable.Core = function Core(rootElement, userSettings) { */ this.listen = function() { Handsontable.activeGuid = instance.guid; - - if (document.activeElement && document.activeElement !== document.body) { - document.activeElement.blur(); - } else if (!document.activeElement) { //IE - document.body.focus(); - } }; /** diff --git a/src/editors/_baseEditor.js b/src/editors/_baseEditor.js index c0f08db054c..3cf4d14f334 100644 --- a/src/editors/_baseEditor.js +++ b/src/editors/_baseEditor.js @@ -58,6 +58,12 @@ BaseEditor.prototype.prepare = function(row, col, prop, td, originalValue, cellP this.originalValue = originalValue; this.cellProperties = cellProperties; + if (this.instance.view.isMouseDown() && document.activeElement && document.activeElement !== document.body) { + document.activeElement.blur(); + } else if (!document.activeElement) { //IE + document.body.focus(); + } + this.state = Handsontable.EditorState.VIRGIN; };