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

The composing property is not accurate in some scenarios. #12624

Open
tianhenmei opened this issue Dec 28, 2024 · 1 comment
Open

The composing property is not accurate in some scenarios. #12624

tianhenmei opened this issue Dec 28, 2024 · 1 comment
Labels
can't reproduce need more info Further information is requested

Comments

@tianhenmei
Copy link

Vue version

3.5.13

Link to minimal reproduction

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing

Steps to reproduce

The composing property is achieved in packages/runtime-dom/src/directives/vModel.ts, it'is not accurate in some scenarios.
For example, when you need to input an SMS code, the input field gets focused at first. If you click the submit button, it triggers the blur event, which also triggers the input value check. Then, the input gets focused again. At this point, the compositionstart event has been triggered, but not the compositionend event. So, composing is still true, and there's no way to set it to false. When you receive the SMS code, on iOS, you can tap the keyboard to fill in the code right away. However, if some UI library relies on this property and only allows the value to be set when composing is false, the user won't be able to enter anything into the field.

Actually, there's a property called isComposing that we can check in JavaScript. Why not handle this yourself?

What is expected?

Why do you need to handle the composing property in packages/runtime-dom/src/directives/vModel.ts?

What is actually happening?

The vant ui library relies on this property and only allows the value to be set when composing is false, the user won't be able to enter anything into the field.

System Info

No response

Any additional comments?

No response

@edison1105
Copy link
Member

This might be using the implementation form vue2. The absence of isComposing might be to ensure compatibility across different browser environments(perhaps isComposing behaves inconsistently in various browsers/webviews).
Since there is no reproducible demo, we cannot investigate the reason. Could you please provide a demo that can reproduce the issues?

@edison1105 edison1105 added need more info Further information is requested can't reproduce labels Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't reproduce need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants