From 8ad53a9d41691f8ebc55736a63a99055eb618369 Mon Sep 17 00:00:00 2001 From: Jan Siegel Date: Wed, 18 Nov 2015 15:08:43 +0100 Subject: [PATCH] Move the activeElement check to the base editor --- src/core.js | 6 ------ src/editors/_baseEditor.js | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) 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; };