From fbe36c7f5a3379a31b553e7c85a24e779440e9d3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 17 Jul 2019 19:03:22 +0200 Subject: [PATCH] Elastic: Fix bug where use of Tab key on autocomplete causes double insertion into a recipient input (#6850) --- skins/elastic/ui.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index d29e30494..401d52b71 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -3109,13 +3109,9 @@ function rcube_elastic_ui() insert_recipient(this.name, this.email); }); - // setTimeout() here is needed for proper input reset on paste event - // This is also the reason why we need parse_lock - setTimeout(function() { - input.val(result.text); - apply_func(); - input_len_update(); - }, 1); + input.val(result.text); + apply_func(); + input_len_update(); return result.recipients.length > 0; }, @@ -3129,6 +3125,7 @@ function rcube_elastic_ui() paste = (e.originalEvent.clipboardData || window.clipboardData).getData('text') || ''; // insert pasted text in place of the selection (or just cursor position) value = value.substring(0, this.selectionStart) + paste + value.substring(this.selectionEnd); + e.preventDefault(); } update_func(value);