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] v-text-field not wait chinese input method (IME) input to end when use v-model bind a computed attribute #5748

Closed
LazyLZ opened this issue Nov 28, 2018 · 5 comments · Fixed by #11134
Assignees
Labels
C: VTextField VTextField platform specific The issue only occurs on a specific platform T: bug Functionality that does not work as intended/expected
Milestone

Comments

@LazyLZ
Copy link

LazyLZ commented Nov 28, 2018

Versions and Environment

Vuetify: 1.3.11
Vue: 2.5.17
Browsers: Maxthon 5.2.5.4000, Google Chrome, Mozilla Firefox, Safari, Microsoft Edge, Internet Explorer, Opera, Other
OS: iOS, Mac OSX

Steps to reproduce

  1. a v-text-field use v-model bind a computed attribute
<v-text-field
    label="Chinese input | 中文输入"
    v-model="inputFormatted"
></v-text-field>
  1. change input value in set method of computed attribute
  data: ()=>({
    inputValue: ''
  }),
  computed: {
    inputFormatted: {
      get(){
        return this.inputValue
      },
      set(val) {
        this.inputValue = val.toUpperCase()
      }
    }
  }
  1. The code in set method will break the default chinese input method in iOS and macOS, which will prevent you from entering Chinese character

Expected Behavior

text field wait IME input to end

Actual Behavior

text field interrupts the input of IME and can't input chinese character

Reproduction Link

https://codepen.io/lazylz/pen/WYgmBb

Other comments

This problem can also occur in other languages that require an IME (Japanese, Korean etc.)
this issue not happened on native input tag,because v-model waits input method input to end (use compositionend event) before it refresh value

@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected platform specific The issue only occurs on a specific platform labels Nov 28, 2018
@MajesticPotatoe MajesticPotatoe added the C: VTextField VTextField label Apr 9, 2019
@myleslee
Copy link
Contributor

myleslee commented Jul 21, 2019

This is not platform specific. It's a general issue for users using IME, which has been well documented by Vue.js.
https://vuejs.org/v2/guide/forms.html#vmodel-ime-tip

More explanation can be found in issue vuejs/vue#5902

The solution is cooked right into the directive v-model but vuetify fails to respect it. See Source code of v-model

Thing can get very ugly in terms of a search input where incorrect results will be returned in the middle of IME composing (before the intended character arrives in the input).

Interestingly, Quasar has the same issue quasarframework/quasar#4482

@kouqon
Copy link
Contributor

kouqon commented Apr 15, 2020

VTextField update internalValue on onInput(evt) and onKeyDown(evt) .
But these method do not check evt.isComposing property.
internalValue should not update if (evt.isComposing == true) to prevent conflict with InputMethod.

VTextField-isComposing.patch.txt

kouqon added a commit to kouqon/vuetify that referenced this issue Apr 16, 2020
johnleider added a commit to kouqon/vuetify that referenced this issue Apr 20, 2020
johnleider added a commit that referenced this issue Apr 20, 2020
…11134)

fixes #5748

* fix(VTextField): Skip value property update if IME composing string

* style(VTextField): adjust code styling

Co-authored-by: John Leider <[email protected]>
@johnleider johnleider self-assigned this Apr 20, 2020
@johnleider johnleider added this to the v2.2.x milestone Apr 20, 2020
@suzukiichiro
Copy link

Chrome only sends events where the isComposing property is true
Therefore, the input value is not reflected

kouqon pushed a commit to kouqon/vuetify that referenced this issue Apr 23, 2020
johnleider pushed a commit to kouqon/vuetify that referenced this issue Apr 24, 2020
johnleider added a commit that referenced this issue Apr 24, 2020
fixes #11190

* fix(VTextField): Update value on compositionend

See #5748

* style(VTextField): add empty line after const declaration

Co-authored-by: k_kondou00 <[email protected]>
Co-authored-by: John Leider <[email protected]>
@kingyue737

This comment has been minimized.

@johnleider
Copy link
Member

We kindly ask users to not comment on closed/resolved issues. If you believe that this issue has not been correctly resolved, please create a new issue showing the regression or create a new discussion.

If you have any questions, please reach out to us in our Discord community.

@vuetifyjs vuetifyjs locked as resolved and limited conversation to collaborators Nov 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: VTextField VTextField platform specific The issue only occurs on a specific platform T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants