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/11/18 10:17:47 UTC

[myfaces-tobago] branch t5_selectMany updated (82ac5046c2 -> db616712de)

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

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


    from 82ac5046c2 Merge remote-tracking branch 'origin/tobago-5.x' into t5_selectMany
     new 6673ebacc2 feat(selectMany): fix focus for inline=true
     new 32c3083605 feat(selectMany): width=0 for readonly filter
     new 49b4417e8f feat(selectMany): impl tabindex
     add 60015ffd74 build(deps): bump dependency-check-maven from 7.3.0 to 7.3.1 (#3424)
     add 3bb0c0adcb Tobago 5.x fix code scanning (#3429)
     new db616712de Merge remote-tracking branch 'origin/tobago-5.x' into t5_selectMany

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |  2 +-
 .../tobago/internal/component/AbstractUIPage.java  | 47 ++++++++++++++++++----
 .../renderkit/renderer/SelectManyRenderer.java     |  6 ++-
 .../AbstractUIPageUnitTest.java}                   | 34 ++++++++++------
 .../internal/config/AbstractTobagoTestBase.java    |  9 +++--
 tobago-theme/src/main/scss/_tobago.scss            |  5 +++
 .../src/main/ts/tobago-select-many.ts              | 27 +++++++------
 7 files changed, 93 insertions(+), 37 deletions(-)
 copy tobago-core/src/test/java/org/apache/myfaces/tobago/internal/{renderkit/renderer/TextareaRendererUnitTest.java => component/AbstractUIPageUnitTest.java} (52%)


[myfaces-tobago] 01/04: feat(selectMany): fix focus for inline=true

Posted by hn...@apache.org.
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 6673ebacc209e19e795ca3b514315d8c0198bb77
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Nov 17 11:32:20 2022 +0100

    feat(selectMany): fix focus for inline=true
    
    Issue: TOBAGO-2159
---
 .../tobago-theme-standard/src/main/ts/tobago-select-many.ts    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many.ts
index 0bae17227b..6a8d9f7107 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many.ts
@@ -213,7 +213,7 @@ class SelectMany extends HTMLElement {
     if (this.isDeleted(event.target as Element)) {
       // do nothing, this is probably a removed badge
     } else if (this.isPartOfSelectField(event.target as Element)
-      || this.isPartOfDropdownMenu(event.target as Element)) {
+      || this.isPartOfTobagoOptions(event.target as Element)) {
 
       if (!this.filterInput.disabled) {
         this.filterInput.focus();
@@ -324,13 +324,13 @@ class SelectMany extends HTMLElement {
     }
   }
 
-  private isPartOfDropdownMenu(element: Element): boolean {
+  private isPartOfTobagoOptions(element: Element): boolean {
     if (element) {
-      if (element.classList.contains(this.CssClass.DROPDOWN_MENU)
+      if (element.classList.contains(this.CssClass.TOBAGO_OPTIONS)
         && this.id === element.getAttribute("name")) {
         return true;
       } else {
-        return element.parentElement ? this.isPartOfDropdownMenu(element.parentElement) : false;
+        return element.parentElement ? this.isPartOfTobagoOptions(element.parentElement) : false;
       }
     } else {
       return false;
@@ -382,7 +382,7 @@ class SelectMany extends HTMLElement {
     if (event.relatedTarget !== null) {
       //relatedTarget is the new focused element; null indicate a mouseclick or an inactive browser window
       if (!this.isPartOfSelectField(event.relatedTarget as Element)
-        && !this.isPartOfDropdownMenu(event.relatedTarget as Element)) {
+        && !this.isPartOfTobagoOptions(event.relatedTarget as Element)) {
         this.setFocus(false);
         this.hideDropdown();
       }


[myfaces-tobago] 04/04: Merge remote-tracking branch 'origin/tobago-5.x' into t5_selectMany

Posted by hn...@apache.org.
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 db616712de6fffd6190d0ed9b617f18efeab28a0
Merge: 49b4417e8f 3bb0c0adcb
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Nov 18 11:17:37 2022 +0100

    Merge remote-tracking branch 'origin/tobago-5.x' into t5_selectMany

 pom.xml                                            |  2 +-
 .../tobago/internal/component/AbstractUIPage.java  | 47 ++++++++++++++++---
 .../internal/component/AbstractUIPageUnitTest.java | 53 ++++++++++++++++++++++
 .../internal/config/AbstractTobagoTestBase.java    |  9 ++--
 4 files changed, 100 insertions(+), 11 deletions(-)


[myfaces-tobago] 03/04: feat(selectMany): impl tabindex

Posted by hn...@apache.org.
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 49b4417e8f06eb6dab7f53d5fbd9b5ade6517a86
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Nov 18 11:17:16 2022 +0100

    feat(selectMany): impl tabindex
    
    Issue: TOBAGO-2159
---
 .../internal/renderkit/renderer/SelectManyRenderer.java |  6 ++++--
 .../src/main/ts/tobago-select-many.ts                   | 17 ++++++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRenderer.java
index 1bfb380596..ef30a8cccf 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRenderer.java
@@ -79,6 +79,7 @@ public class SelectManyRenderer<T extends AbstractUISelectMany> extends SelectMa
     final boolean inline = component.isInline();
     final Markup markup = component.getMarkup();
     final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, component);
+    final Integer tabIndex = component.getTabIndex();
 
     encodeHiddenSelect(facesContext, component, items, clientId, selectedId, disabled);
 
@@ -87,7 +88,7 @@ public class SelectManyRenderer<T extends AbstractUISelectMany> extends SelectMa
         inline ? BootstrapClass.LIST_GROUP : BootstrapClass.DROPDOWN,
         inline ? BootstrapClass.borderColor(ComponentUtils.getMaximumSeverity(component)) : null);
 
-    encodeSelectField(facesContext, component, clientId, fieldId, filterId, filter, disabled, inline, title);
+    encodeSelectField(facesContext, component, clientId, fieldId, filterId, filter, disabled, inline, title, tabIndex);
     encodeOptions(facesContext, component, items, clientId, inline, disabled);
 
     writer.endElement(HtmlElements.DIV);
@@ -120,7 +121,7 @@ public class SelectManyRenderer<T extends AbstractUISelectMany> extends SelectMa
 
   private void encodeSelectField(final FacesContext facesContext, final T component,
       final String clientId, final String fieldId, final String filterId, final String filter, final boolean disabled,
-      final boolean inline, final String title) throws IOException {
+      final boolean inline, final String title, final Integer tabIndex) throws IOException {
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
 
     writer.startElement(HtmlElements.DIV);
@@ -144,6 +145,7 @@ public class SelectManyRenderer<T extends AbstractUISelectMany> extends SelectMa
     writer.writeAttribute(HtmlAttributes.AUTOCOMPLETE, "off", false);
     writer.writeAttribute(HtmlAttributes.READONLY, filter == null);
     writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
+    writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
 
     writer.endElement(HtmlElements.INPUT);
 
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many.ts
index 6a8d9f7107..e36c68e86d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-many.ts
@@ -141,8 +141,9 @@ class SelectMany extends HTMLElement {
     const row: HTMLTableRowElement = this.tbody.querySelector(`[data-tobago-value="${itemValue}"]`);
     if (option.selected) {
       // create badge
+      const tabIndex: number = this.filterInput.tabIndex;
       this.filterInput.insertAdjacentHTML("beforebegin",
-        this.getRowTemplate(itemValue, row.innerText, option.disabled || this.hiddenSelect.disabled));
+        this.getRowTemplate(itemValue, row.innerText, option.disabled || this.hiddenSelect.disabled, tabIndex));
 
       // todo: nicer adding the @click with lit-html
       const closeButton = this.selectField
@@ -181,13 +182,15 @@ class SelectMany extends HTMLElement {
     }
   }
 
-  getRowTemplate(value: string, text: string, disabled: boolean): string {
-    return `
+  getRowTemplate(value: string, text: string, disabled: boolean, tabIndex: number): string {
+    return disabled ? `
 <span class="btn-group" role="group" data-tobago-value="${value}">
-  <tobago-badge class="badge text-bg-primary btn
-  ${disabled ? "disabled" : ""}">${text}</tobago-badge>
-  ${disabled ? ""
-      : "<button type='button' class='tobago-button btn btn-secondary badge'><i class='bi-x-lg'></i></button>"}
+  <tobago-badge class="badge text-bg-primary btn disabled">${text}</tobago-badge>
+</span>` : `
+<span class="btn-group" role="group" data-tobago-value="${value}">
+  <tobago-badge class="badge text-bg-primary btn">${text}</tobago-badge>
+  <button type='button' class='tobago-button btn btn-secondary badge'
+  ${tabIndex > 0 ? " tabindex='" + String(tabIndex) + "'" : ""}><i class='bi-x-lg'></i></button>
 </span>`;
   }
 


[myfaces-tobago] 02/04: feat(selectMany): width=0 for readonly filter

Posted by hn...@apache.org.
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 32c3083605bd345f04aae0cd8139983cdcbaf960
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Nov 17 12:38:32 2022 +0100

    feat(selectMany): width=0 for readonly filter
    
    Issue: TOBAGO-2159
---
 tobago-theme/src/main/scss/_tobago.scss | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tobago-theme/src/main/scss/_tobago.scss b/tobago-theme/src/main/scss/_tobago.scss
index 7b129d812e..58a28fb3f5 100644
--- a/tobago-theme/src/main/scss/_tobago.scss
+++ b/tobago-theme/src/main/scss/_tobago.scss
@@ -1292,6 +1292,11 @@ tobago-select-many {
       &:focus {
         box-shadow: none;
       }
+
+      &:read-only {
+        width: 0;
+        min-width: 0;
+      }
     }
   }