[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX][UX] Element Plus Select: Single-select dropdown reopening regression

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a28024c41e4a_38251dcc050349@gitlab-sidekiq-low-urgency-cpu-bound-v2-d4ddd5fd7-6xxjd.mail>

ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
69ecdeed by MAGENE Sem Joel at 2026-06-09T11:50:54+00:00
[FIX][UX] Element Plus Select: Single-select dropdown reopening regression
---
* [FIX][UX] Element Plus Select: Single-select dropdown reopening regression

See merge request tikiwiki/tiki!10465

- - - - -


2 changed files:

- src/js/vue-widgets/element-plus-ui/src/components/Select/Select.vue
- src/js/vue-widgets/element-plus-ui/src/tests/components/Select.test.js


Changes:

=====================================
src/js/vue-widgets/element-plus-ui/src/components/Select/Select.vue
=====================================
@@ -19,7 +19,12 @@ watch(() => props.value, (newValue) => {
 });
 
 const isInvalid = computed(() => normalize(props.isInvalid, false));
-const multiple = computed(() => normalize(props.multiple, false))
+const normalizeBooleanAttribute = (value) => {
+    const normalized = normalize(value, false);
+    // HTML boolean attributes can be serialized as an empty string.
+    return normalized === "" || Boolean(normalized);
+}
+const multiple = computed(() => normalizeBooleanAttribute(props.multiple))
 const clearable = computed(() => normalize(props.clearable, false));
 const collapseTags = computed(() => normalize(props.collapseTags, false));
 const filterable = computed(() =>
@@ -136,7 +141,7 @@ export const DATA_TEST_ID = {
     <ConfigWrapper :language="language">
         <div :class="{ 'invalid': isInvalid }" :data-testid="DATA_TEST_ID.SELECT_WRAPPER" ref="wrapperRef">
             <el-select v-model="modelValue" :multiple="multiple" :filterable="filterable" :allow-create="allowCreate"
-                default-first-option :reserve-keyword="false" :placeholder="placeholder" :teleported="false" :automatic-dropdown="true"
+                default-first-option :reserve-keyword="false" :placeholder="placeholder" :teleported="false" :automatic-dropdown="multiple"
                 @change="handleValueChange" :multiple-limit="parseInt(max ?? 0, 10)" :clearable="clearable"
                 :collapse-tags="collapseTags" :max-collapse-tags="parseInt(maxCollapseTags ?? 0, 10)" :size="size"
                 :data-testid="DATA_TEST_ID.SELECT_ELEMENT" :remote-method="remoteMethod"
@@ -155,4 +160,4 @@ export const DATA_TEST_ID = {
             </el-select>
         </div>
     </ConfigWrapper>
-</template>
\ No newline at end of file
+</template>


=====================================
src/js/vue-widgets/element-plus-ui/src/tests/components/Select.test.js
=====================================
@@ -71,7 +71,12 @@ describe("Select", () => {
         });
 
         expect(ElSelect).toHaveBeenCalledWith(
-            expect.objectContaining({ modelValue: JSON.parse(basicProps.value), remote: false, "empty-values": [null, undefined] }),
+            expect.objectContaining({
+                modelValue: JSON.parse(basicProps.value),
+                remote: false,
+                "automatic-dropdown": false,
+                "empty-values": [null, undefined],
+            }),
             expect.any(Object)
         );
 
@@ -114,6 +119,7 @@ describe("Select", () => {
                 "collapse-tags": true,
                 "max-collapse-tags": parseInt(givenProps.maxCollapseTags, 10),
                 "multiple-limit": parseInt(givenProps.max, 10),
+                "automatic-dropdown": true,
                 "empty-values": [null, undefined],
             }),
             expect.any(Object)
@@ -141,6 +147,31 @@ describe("Select", () => {
         );
     });
 
+    test.each([
+        { name: "missing", multipleProp: undefined, expectedMultiple: false },
+        { name: "false boolean", multipleProp: false, expectedMultiple: false },
+        { name: "false string", multipleProp: "false", expectedMultiple: false },
+        { name: "true boolean", multipleProp: true, expectedMultiple: true },
+        { name: "true string", multipleProp: "true", expectedMultiple: true },
+        { name: "jQuery boolean attribute", multipleProp: "multiple", expectedMultiple: true },
+        { name: "empty boolean attribute", multipleProp: "", expectedMultiple: true },
+    ])("normalizes the multiple prop as a boolean: $name", ({ multipleProp, expectedMultiple }) => {
+        render(Select, {
+            props: {
+                ...basicProps,
+                ...(multipleProp === undefined ? {} : { multiple: multipleProp }),
+            },
+        });
+
+        expect(ElSelect).toHaveBeenCalledWith(
+            expect.objectContaining({
+                multiple: expectedMultiple,
+                "automatic-dropdown": expectedMultiple,
+            }),
+            expect.any(Object)
+        );
+    });
+
     test("renders correctly grouped options", () => {
         const givenProps = {
             ...basicProps,



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/69ecdeed07488db0c30cbf1df24e0868b77f9dfc

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/69ecdeed07488db0c30cbf1df24e0868b77f9dfc
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.