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]The composing property is not accurate in some scenarios. #13288

Closed
tianhenmei opened this issue Dec 28, 2024 · 2 comments
Closed

Comments

@tianhenmei
Copy link

Reproduction Link

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

Vant Version

4.2.0

Describe the Bug

/packages/vant/src/field/Field.tsx 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.

Reproduce Steps

The composing property is achieved in vue, 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?

Device / Browser

iOS

@inottn
Copy link
Collaborator

inottn commented Dec 29, 2024

Thanks for your feedback. Could you provide an repro of the scenario mentioned above?

@inottn
Copy link
Collaborator

inottn commented Jan 13, 2025

Due to compatibility problems, we are unable to use this feature at the moment. https://caniuse.com/?search=isComposing

@inottn inottn closed this as completed Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants