Incorrect check for the active suggestion
authorAlexander Ebert <ebert@woltlab.com>
Sat, 11 Dec 2021 12:40:45 +0000 (13:40 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 11 Dec 2021 12:40:45 +0000 (13:40 +0100)
ts/WoltLabSuite/Core/Ui/Search/Input.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Input.js

index 238e5aa5d8f0f0f32876102805e7b4d219ab884d..e80107de95a8951e4ff4b95783aae2006fcbe6f6 100644 (file)
@@ -103,7 +103,7 @@ class UiSearchInput {
    * Handles the 'keydown' event.
    */
   private keydown(event: KeyboardEvent): void {
-    if ((this.activeItem !== null && UiDropdownSimple.isOpen(this.dropdownContainerId)) || this.preventSubmit) {
+    if ((this.activeItem && UiDropdownSimple.isOpen(this.dropdownContainerId)) || this.preventSubmit) {
       if (event.key === "Enter") {
         event.preventDefault();
       }
@@ -119,7 +119,7 @@ class UiSearchInput {
    */
   private keyup(event: KeyboardEvent): void {
     // handle dropdown keyboard navigation
-    if (this.activeItem !== null || !this.autoFocus) {
+    if (this.activeItem || !this.autoFocus) {
       if (UiDropdownSimple.isOpen(this.dropdownContainerId)) {
         if (event.key === "ArrowUp") {
           event.preventDefault();
index a785b2f353a84a8fbd4526a4c874d05fd2321b1d..eb3e1fbb3ed57fe086e2ca0deff18555cfb4ba25 100644 (file)
@@ -83,7 +83,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Dom/Ut
          * Handles the 'keydown' event.
          */
         keydown(event) {
-            if ((this.activeItem !== null && Simple_1.default.isOpen(this.dropdownContainerId)) || this.preventSubmit) {
+            if ((this.activeItem && Simple_1.default.isOpen(this.dropdownContainerId)) || this.preventSubmit) {
                 if (event.key === "Enter") {
                     event.preventDefault();
                 }
@@ -97,7 +97,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Dom/Ut
          */
         keyup(event) {
             // handle dropdown keyboard navigation
-            if (this.activeItem !== null || !this.autoFocus) {
+            if (this.activeItem || !this.autoFocus) {
                 if (Simple_1.default.isOpen(this.dropdownContainerId)) {
                     if (event.key === "ArrowUp") {
                         event.preventDefault();