From 0203544ae391c766f5de76e7564086428e31a8ae Mon Sep 17 00:00:00 2001 From: portikM Date: Fri, 13 Dec 2024 14:24:39 -0500 Subject: [PATCH] fix: minor fix --- src/components/KSelect/KSelect.vue | 3 ++- src/components/KSelect/KSelectItems.vue | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/KSelect/KSelect.vue b/src/components/KSelect/KSelect.vue index 1533b8e6f2..98ce90b6dc 100644 --- a/src/components/KSelect/KSelect.vue +++ b/src/components/KSelect/KSelect.vue @@ -671,11 +671,12 @@ watch(() => props.items, (newValue, oldValue) => { } for (let i = 0; i < selectItems.value?.length; i++) { - // Ensure each item has a `selected` property + // Ensure each item has a selected property if (selectItems.value[i].selected === undefined) { selectItems.value[i].selected = false } + // ensure each item has a unique key property let selectItemKey = `${selectItems.value[i].label?.replace(/ /gi, '-')?.replace(/[^a-z0-9-_]/gi, '')}-${i}` if (selectItemKey.includes('undefined')) { selectItemKey = `select-item-label-${i}` diff --git a/src/components/KSelect/KSelectItems.vue b/src/components/KSelect/KSelectItems.vue index 2d4dccc39d..85e15ae32d 100644 --- a/src/components/KSelect/KSelectItems.vue +++ b/src/components/KSelect/KSelectItems.vue @@ -3,6 +3,7 @@ v-for="item in nonGroupedItems" :key="item.key" ref="kSelectItem" + :data-key="item.key" :item="item" @arrow-down="() => shiftFocus(item.key, 'down')" @arrow-up="() => shiftFocus(item.key, 'up')" @@ -30,6 +31,7 @@ v-for="item in getGroupItems(group)" :key="item.key" ref="kSelectItem" + :data-key="item.key" :item="item" @arrow-down="() => shiftFocus(item.key, 'down')" @arrow-up="() => shiftFocus(item.key, 'up')"