QSelect use-input v-model and don't clear on blur #12744
Replies: 4 comments
-
I have the same issue, thanks for opening the topic |
Beta Was this translation helpful? Give feedback.
-
To add to that, clear on blur is quite counter-intuitive, especially when q-select appears in a form next to a regular select: they both look quite identical and it is very naturally for a human to enter a value in a field and expect it to stay there. Having two fields behaving differently creates a lot of frustration. Especially as it is unclear to the user that he must hit enter to save the value in the select (which would submit the whole form if pressed on some other field) |
Beta Was this translation helpful? Give feedback.
-
Until this will get any attention from the maintainers, here is a simple snippet that worked for me: <template>
<q-select
v-model="value"
input-debounce="100"
@blur="onBlur"
@input-value="setVal"
/>
</template>
<script setup lang="ts">
import {ref} from 'vue';
const value = defineModel()
const tmp = ref('')
function setVal(val) {
tmp.value = val
}
function onBlur() {
if (tmp.value && !value.value) value.value = tmp.value
}
</script> |
Beta Was this translation helpful? Give feedback.
-
Currently the QSelect's search input clears automatically on blur, this might be undesired behavior (especially if we make it clearable) and there is no way to configure this
Maybe it should not clear on blur by default and have a clear-input-onblur prop
It would also be nice to provide a v-model:input-value, it would solve a few problems as right now there is an event that emits the input value but to set the input value we need to use a ref with a method which is really less than ideal
Beta Was this translation helpful? Give feedback.
All reactions