You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2023/02/10 16:33:33 UTC

[myfaces-tobago] 03/04: fix(selectManyList): remove badge

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 2b76f344b23c0a005412314bd3ba12f10769c808
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Feb 10 16:55:29 2023 +0100

    fix(selectManyList): remove badge
    
    Issue: TOBAGO-2194
---
 .../src/main/ts/tobago-select-many-list.ts                | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-list.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-list.ts
index abab360ee2..8058b29db2 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-list.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many-list.ts
@@ -37,7 +37,8 @@ class SelectManyList extends HTMLElement {
     ARROW_UP: "ArrowUp",
     ENTER: "Enter",
     ESCAPE: "Escape",
-    SPACE: " "
+    SPACE: " ",
+    TAB: "Tab"
   };
 
   constructor() {
@@ -183,7 +184,9 @@ class SelectManyList extends HTMLElement {
       if (this.badgeCloseButtons.length > 0 && this.filterInput.id === document.activeElement.id) {
         this.badgeCloseButtons.item(this.badgeCloseButtons.length - 1).focus();
       }
-      this.filterInput.disabled = this.badgeCloseButtons.length > 0;
+      if (!this.preselectedRow) {
+        this.filterInput.disabled = this.badgeCloseButtons.length > 0;
+      }
     }
   }
 
@@ -258,10 +261,15 @@ class SelectManyList extends HTMLElement {
           event.preventDefault();
           const row = this.tbody.querySelector<HTMLTableRowElement>("." + this.CssClass.TOBAGO_PRESELECT);
           this.selectRow(row);
+          this.filterInput.disabled = false;
+          this.filterInput.focus({preventScroll: true});
         } else if (document.activeElement.id === this.filterInput.id) {
           this.showDropdown();
         }
         break;
+      case this.Key.TAB:
+        this.removePreselection();
+        break;
     }
   }
 
@@ -302,6 +310,9 @@ class SelectManyList extends HTMLElement {
     if (!this.dropdownMenu) {
       row.scrollIntoView({block: "center"});
     }
+
+    this.filterInput.disabled = false;
+    this.filterInput.focus({preventScroll: true});
   }
 
   private removePreselection(): void {