fix: refs #7936 rollback
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-12-10 10:35:05 +01:00
parent 43629a3bc3
commit 2939ddcfb7
1 changed files with 23 additions and 0 deletions

View File

@ -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();
}
}
}
</script>
<template>
@ -303,6 +325,7 @@ defineExpose({ opts: myOptions });
:input-debounce="useURL ? '300' : '0'"
:loading="isLoading"
@virtual-scroll="onScroll"
@keydown="handleKeyDown"
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
>
<template #append>