From e0a04acb067983efafbaf62132acdfa5367a8e3c Mon Sep 17 00:00:00 2001 From: Eva Date: Sun, 21 May 2023 14:28:14 +0200 Subject: [PATCH] client/search: fix js error when pressing esc key `this` became inaccessible from hide() when the function was called from outside. Note: I don't like the behavior of Escape and Delete, as pressing them more than once reverses their action. --- client/js/controls/auto_complete_control.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/js/controls/auto_complete_control.js b/client/js/controls/auto_complete_control.js index fb3792fc..ac618d9c 100644 --- a/client/js/controls/auto_complete_control.js +++ b/client/js/controls/auto_complete_control.js @@ -147,7 +147,9 @@ class AutoCompleteControl { let func = null; if (this._isVisible) { if (key === KEY_ESCAPE) { - func = this.hide; + func = () => { + this.hide(); + }; } else if (key === KEY_TAB && shift) { func = () => { this._selectPrevious();