Vuetify: VTextField selectionEnd error

Created on 12 Oct 2017  路  4Comments  路  Source: vuetifyjs/vuetify

@KaelWD

Steps to reproduce

Put a type="number" inside v-text-field, like:
<v-text-field v-model="example" hide-details type="number"></v-text-field>

When you change to fill other input, it appears an error:

Failed to read the 'selectionEnd' property from 'HTMLInputElement': The input element's type ('number') does not support selection

Versions


With android devices, with vue 2.4.4 and at least with vuetify 0.16.4

What is expected ?

We expected that the content of input is not deleted.

What is actually happening ?

When I want to fill in another entry, the previous entry is empty.

Reproduction Link


https://codepen.io/anon/pen/OxwONy

bug

Most helpful comment

Masks are not supported with type="number". If you want to return a number when using masks you should use v-model.number instead.

All 4 comments

This is caused by resetSelections being run on every input event. That should only happen if there is a mask set.

@KaelWD will this also fix the error on setting mask option in a textfield?

Demo:
https://codepen.io/anon/pen/OxwONy

Error:

Uncaught DOMException: Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.

Masks are not supported with type="number". If you want to return a number when using masks you should use v-model.number instead.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

Was this page helpful?
0 / 5 - 0 ratings