From 2939ddcfb7606f2bc15b087d110999fe990a88d3 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 10 Dec 2024 10:35:05 +0100 Subject: [PATCH] fix: refs #7936 rollback --- src/components/common/VnSelect.vue | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index d39d1143f..1082df4f9 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -279,6 +279,28 @@ async function onScroll({ to, direction, from, index }) { } defineExpose({ opts: myOptions }); + +function handleKeyDown(event) { + if (event.key === 'Tab') { + event.preventDefault(); + + const inputValue = vnSelectRef.value?.inputValue; + + if (inputValue) { + const matchingOption = myOptions.value.find( + (option) => + option[optionLabel.value].toLowerCase() === inputValue.toLowerCase() + ); + + if (matchingOption) { + emit('update:modelValue', matchingOption[optionValue.value]); + } else { + emit('update:modelValue', inputValue); + } + vnSelectRef.value?.hidePopup(); + } + } +}