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 2022/12/02 14:58:54 UTC

[myfaces-tobago] 02/02: feat(selectManyList): handle filter null

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

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

commit abbe4f273cc8e13a31bf96662d7d961f8fc893c5
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Dec 2 15:58:27 2022 +0100

    feat(selectManyList): handle filter null
    
    Issue: TOBAGO-2159
---
 .../tobago/internal/renderkit/renderer/SelectManyListRenderer.java    | 2 +-
 .../tobago-theme-standard/src/main/ts/tobago-select-many-list.ts      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyListRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyListRenderer.java
index ee5234a993..d6ebee277d 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyListRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyListRenderer.java
@@ -143,7 +143,7 @@ public class SelectManyListRenderer<T extends AbstractUISelectManyList> extends
     writer.writeIdAttribute(filterId);
     writer.writeClassAttribute(TobagoClass.FILTER, BootstrapClass.FORM_CONTROL);
     writer.writeAttribute(HtmlAttributes.AUTOCOMPLETE, "off", false);
-    writer.writeAttribute(HtmlAttributes.READONLY, filter == null);
+    writer.writeAttribute(HtmlAttributes.READONLY, filter == null || filter.isEmpty());
     writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
     writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
     renderFocus(clientId, component.isFocus(), component.isError(), facesContext, writer);
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 da5eec2dfc..fdc7a4cae5 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
@@ -105,7 +105,7 @@ class SelectManyList extends HTMLElement {
     this.initList();
 
     // init filter
-    if (this.filter != null) {
+    if (this.filter) {
       const input = this.filterInput;
       input.addEventListener("keyup", this.filterEvent.bind(this));
     }
@@ -178,7 +178,7 @@ class SelectManyList extends HTMLElement {
       row.classList.remove(this.CssClass.TABLE_PRIMARY);
     }
 
-    if (!this.classList.contains(this.CssClass.TOBAGO_DISABLED) && this.filter === null) {
+    if (!this.classList.contains(this.CssClass.TOBAGO_DISABLED) && !this.filter) {
       // disable input field to prevent focus.
       if (this.badgeCloseButtons.length > 0 && this.filterInput.id === document.activeElement.id) {
         this.badgeCloseButtons.item(this.badgeCloseButtons.length - 1).focus();