Skip to content

Commit

Permalink
fix(VTextField): update value on compositionend (#11194)
Browse files Browse the repository at this point in the history
fixes #11190

* fix(VTextField): Update value on compositionend

See #5748

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

Co-authored-by: k_kondou00 <k_kondou00@shimadzu-techno.co.jp>
Co-authored-by: John Leider <john.j.leider@gmail.com>
  • Loading branch information
3 people committed Apr 24, 2020
1 parent 4ef70b4 commit f51bef6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/vuetify/src/components/VTextField/VTextField.ts
Expand Up @@ -401,6 +401,7 @@ export default baseMixins.extend<options>().extend({
input: this.onInput,
focus: this.onFocus,
keydown: this.onKeyDown,
compositionend: this.onCompositionEnd,
}),
ref: 'input',
})
Expand Down Expand Up @@ -443,6 +444,12 @@ export default baseMixins.extend<options>().extend({

this.$refs.input.focus()
},
onCompositionEnd (e: Event) {
const target = e.target as HTMLInputElement

this.internalValue = target.value
this.badInput = target.validity && target.validity.badInput
},
onFocus (e?: Event) {
if (!this.$refs.input) return

Expand All @@ -457,9 +464,7 @@ export default baseMixins.extend<options>().extend({
},
onInput (e: Event) {
if (!(e as InputEvent).isComposing) {
const target = e.target as HTMLInputElement
this.internalValue = target.value
this.badInput = target.validity && target.validity.badInput
this.onCompositionEnd(e)
}
},
onKeyDown (e: KeyboardEvent) {
Expand Down

0 comments on commit f51bef6

Please sign in to comment.