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

Inconsistent behavior of v-model sync during IME composition for <input type="search"> #5902

Closed
cloudyan opened this issue Jun 17, 2017 · 8 comments
Labels

Comments

@cloudyan
Copy link

cloudyan commented Jun 17, 2017

What problem does this feature solve?

http://vuejs.org/v2/guide/forms.html#Basic-Usage

For languages that require an IME (Chinese, Japanese, Korean etc.), you’ll notice that v-model doesn’t get updated during IME composition.

<p>msg</p><input v-model="msg"> 

is OK, but type="search" is Not OK

<p>msg</p><input type="search" v-model="msg">

What does the proposed API look like?

For languages that require an IME (Chinese, Japanese, Korean etc.), v-model(type="search") doesn’t get updated during IME composition.

@yyx990803 yyx990803 changed the title <p>msg</p><input type="search" v-model="msg"> Sync v-model during IME composition Jun 17, 2017
@yyx990803
Copy link
Member

This behavior is intentional because syncing during composition often leads to awkward UX. What's the use case for this?

@cloudyan
Copy link
Author

cloudyan commented Jun 17, 2017

example:

https://jsfiddle.net/cloudyan/k9qbs068/

Expect type="search" to work like type="text"

@cloudyan cloudyan reopened this Jun 17, 2017
@yyx990803
Copy link
Member

That's not a use case... what I am asking is why do you want the in-composition string to show up.

@cloudyan
Copy link
Author

cloudyan commented Jun 17, 2017

I don't want to the in-composition string to show up(in using type="search"),That's not what I want. I want to be like type="text", but it is not now

7651e20e-7178-4d3c-bd04-c467b43210fa
abd705c4-6d6c-47b0-885f-c877d6968116

@cloudyan
Copy link
Author

我的英语水平太烂了,问题的描述如截图,我是认为 search 输入框作为 input,应该具备 text 一样的输入体验,我还没看懂关于此处的代码,应该是vue 处理了但显然处理方式不同,才导致这两种不同的显示结果

@yyx990803
Copy link
Member

ok I get it now...

@yyx990803 yyx990803 changed the title Sync v-model during IME composition Inconsistent behavior of v-model sync during IME composition for <input type="search"> Jun 17, 2017
awamwang added a commit to awamwang/vue that referenced this issue Jun 28, 2017
* 'dev' of https://github.com/vuejs/vue:
  build: use cross-platform hook installation with shelljs
  build: move test config files into /test
  build: add script for generating release note
  build: add git commit message validation
  fix(v-model): use consistent behavior during IME composition for other text-like input types (fix vuejs#5902)
  simplify source with rest params
  fix slot resolved incorrect with abstract component (fix vuejs#5888) (vuejs#5895)
  test:improve reserved props test
  test:add bind object test
  fix:when using object syntax in v-bind, special attribute have no effect
  Be able to use string type index in array (vuejs#5889)
  Merge inject when extending a component (vuejs#5827)

# Conflicts:
#	.gitignore
#	src/core/util/options.js
@zuibunan
Copy link

@yyx990803
Android has the same problem , why not handle composition events ?
image
image

@baybal
Copy link

baybal commented Mar 30, 2018

Just stumbled on this issue myself. Handling composition events in an MVC way does not seem to be doable with current browser behavior. It is a breaker for a live search/live autocompletion functionality.

As of now, the best way for me to handle this was to make a form with input element and re-read it on every compositionupdate event. This seems to be the only hack that works with UC browser. For some reason, UC does update the inputs inside forms on composition, yet it gives undefined as event data...

It will be very very good is there will be a standard way set by upstream how to handle that, and proper explanation of bug's nature across browsers in docs.

For me, I'm afraid, the cross browser solution will involve hardcoded hack for each major browser version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants