From 26199f2c15096d6231d82a4c303e164b40ad5bcf Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 23 Jan 2018 16:58:48 +0100 Subject: [PATCH] Reset list state if suggestion was closed --- .../js/WoltLabSuite/Core/Ui/Search/Input.js | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Input.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Input.js index 5e3fbb0f25..91a0f4d5a6 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Input.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Input.js @@ -110,24 +110,25 @@ define(['Ajax', 'Core', 'EventKey', 'Dom/Util', 'Ui/SimpleDropdown'], function(A _keyup: function(event) { // handle dropdown keyboard navigation if (this._activeItem !== null) { - if (!UiSimpleDropdown.isOpen(this._dropdownContainerId)) { - return; - } - - if (EventKey.ArrowUp(event)) { - event.preventDefault(); - - return this._keyboardPreviousItem(); - } - else if (EventKey.ArrowDown(event)) { - event.preventDefault(); - - return this._keyboardNextItem(); + if (UiSimpleDropdown.isOpen(this._dropdownContainerId)) { + if (EventKey.ArrowUp(event)) { + event.preventDefault(); + + return this._keyboardPreviousItem(); + } + else if (EventKey.ArrowDown(event)) { + event.preventDefault(); + + return this._keyboardNextItem(); + } + else if (EventKey.Enter(event)) { + event.preventDefault(); + + return this._keyboardSelectItem(); + } } - else if (EventKey.Enter(event)) { - event.preventDefault(); - - return this._keyboardSelectItem(); + else { + this._activeItem = null; } } -- 2.20.1