From b303c38d948721755b9903a9cb57f542982fd3de Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 14 Oct 2016 16:58:57 +0300 Subject: [PATCH] Fixed bug: change focus from text field or textarea to another text field or textarea (e.g. click to fiedls in the search dialog in replace mode). --- apps/documenteditor/main/app/controller/Main.js | 6 ++++-- .../main/app/controller/Main.js | 6 ++++-- .../spreadsheeteditor/main/app/controller/Main.js | 15 +++++++++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 04d46adc4..1cf8eb4c8 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -163,8 +163,10 @@ define([ $(document.body).on('blur', 'input, textarea', function(e) { if (!me.isModalShowed) { - if (!/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */ - || !e.relatedTarget) { + if (!e.relatedTarget || + !/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* Check if focus in combobox goes from input to it's menu button or menu items */ + && (e.relatedTarget.localName != 'input' || !/form-control/.test(e.relatedTarget.className)) /* Check if focus goes to text input with class "form-control" */ + && (e.relatedTarget.localName != 'textarea' || /area_id/.test(e.relatedTarget.id))) /* Check if focus goes to textarea, but not to "area_id" */ { me.api.asc_enableKeyEvents(true); if (/msg-reply/.test(e.target.className)) me.dontCloseDummyComment = false; diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 57efa7dfc..7ab6de464 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -151,8 +151,10 @@ define([ $(document.body).on('blur', 'input, textarea', function(e) { if (!me.isModalShowed) { - if (!/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */ - || !e.relatedTarget) { + if (!e.relatedTarget || + !/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* Check if focus in combobox goes from input to it's menu button or menu items */ + && (e.relatedTarget.localName != 'input' || !/form-control/.test(e.relatedTarget.className)) /* Check if focus goes to text input with class "form-control" */ + && (e.relatedTarget.localName != 'textarea' || /area_id/.test(e.relatedTarget.id))) /* Check if focus goes to textarea, but not to "area_id" */ { me.api.asc_enableKeyEvents(true); if (/msg-reply/.test(e.target.className)) me.dontCloseDummyComment = false; diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index d624294d9..6af7965da 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -159,12 +159,15 @@ define([ $(document.body).on('blur', 'input, textarea', function(e) { if (this.isAppDisabled === true) return; - if (!me.isModalShowed && !(me.loadMask && me.loadMask.isVisible()) && - (!/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */ - || !e.relatedTarget)) { - me.api.asc_enableKeyEvents(true); - if (/msg-reply/.test(e.target.className)) - me.dontCloseDummyComment = false; + if (!me.isModalShowed && !(me.loadMask && me.loadMask.isVisible())) { + if (!e.relatedTarget || + !/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* Check if focus in combobox goes from input to it's menu button or menu items */ + && (e.relatedTarget.localName != 'input' || !/form-control/.test(e.relatedTarget.className)) /* Check if focus goes to text input with class "form-control" */ + && (e.relatedTarget.localName != 'textarea' || /area_id/.test(e.relatedTarget.id))) /* Check if focus goes to textarea, but not to "area_id" */ { + me.api.asc_enableKeyEvents(true); + if (/msg-reply/.test(e.target.className)) + me.dontCloseDummyComment = false; + } } }).on('dragover', function(e) { var event = e.originalEvent;