Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report][3.1.11] v-text-field type email, when paste conted lead to error #16976

Closed
websitevirtuoso opened this issue Mar 22, 2023 · 3 comments
Assignees
Labels
C: VTextField VTextField T: bug Functionality that does not work as intended/expected T: regression Something that used to work but we broke
Milestone

Comments

@websitevirtuoso
Copy link
Contributor

Environment

Vuetify Version: 3.1.11
Last working version: 3.1.9
Vue Version: 3.2.47
Browsers: Chrome 110.0.0.0
OS: Linux x86_64

Steps to reproduce

  1. Open console log
  2. Paste something in email
  3. Check error in console

VTextField.tsx:148 Uncaught (in promise) DOMException: Failed to set the 'selectionStart' property on 'HTMLInputElement': The input element's type ('email') does not support selection.
at https://unpkg.com/vuetify@3.1.11/dist/vuetify-labs.esm.js:6173:27

Expected Behavior

without error

Actual Behavior

show error

Reproduction Link

https://play.vuetifyjs.com/#...

@websitevirtuoso

This comment was marked as off-topic.

@Yves852
Copy link

Yves852 commented Mar 22, 2023

Same error when v-text-field has the type number.

Uncaught (in promise) DOMException: Failed to set the 'selectionStart' property on 'HTMLInputElement': The input element's type ('number') does not support selection.

No error on types text and password.

@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected T: regression Something that used to work but we broke C: VTextField VTextField and removed S: triage labels Mar 22, 2023
@KaelWD KaelWD added this to the v3.1.x milestone Mar 22, 2023
@KaelWD KaelWD self-assigned this Mar 22, 2023
@KaelWD KaelWD closed this as completed in 9d00a14 Mar 22, 2023
@QozbroQqn
Copy link

for all the people who hates error messages, can't ignore them and don't want to wait for a bugfix can edit the file node_modules/vuetify/lib/components/VTextField/VTextField.mjs and replace the function "onInput" Line 103 with this:

// taken from KaelWD's commit:
    function onInput(e) {
      const el = e.target;
      model.value = el.value;
      if (['text', 'search', 'password', 'tel', 'url'].includes(props.type)) {
        const caretPosition = [el.selectionStart, el.selectionEnd]
        nextTick(() => {
          el.selectionStart = caretPosition[0]
          el.selectionEnd = caretPosition[1]
        })
      }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VTextField VTextField T: bug Functionality that does not work as intended/expected T: regression Something that used to work but we broke
Projects
None yet
Development

No branches or pull requests

4 participants