Skip to content

fix(web): 修复input和textarea在ios输入法上中文快速输入导致的光标丢失问题 #5261

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

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

Li13
Copy link

@Li13 Li13 commented Dec 18, 2024

场景:h5环境ios手机input或textarea上使用v-model
ios输入法输入中文时快速输入,因为valueChangeFn防抖引起的数据不一致,导致中断拼音输入过程,引发光标消失且输入无反应
https://ask.dcloud.net.cn/question/160766?item_id=282074&rf=false
https://ask.dcloud.net.cn/question/195150?item_id=282073&rf=false

_VID_20241218_194534.mp4

@hbcui1984 hbcui1984 requested a review from Copilot May 9, 2025 02:45
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses an issue where fast Chinese input on iOS in input and textarea elements causes the cursor to disappear due to debounced value updates.

  • Introduces a cancelValueChange function in useValueSync to cancel pending debounce/throttle callbacks.
  • Updates the useEvent signature and onInput handler to call cancelValueChange, ensuring timely cancellation during composition events.

@@ -406,6 +407,7 @@ function useEvent(
props: Props,
trigger: CustomEventTrigger,
triggerInput: Function,
cancelValueChange: Function,
Copy link
Preview

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding an explicit TypeScript type annotation for the 'cancelValueChange' parameter in the useEvent function to improve type safety and clarity.

Suggested change
cancelValueChange: Function,
cancelValueChange: (value: any) => void,

Copilot uses AI. Check for mistakes.

@hbcui1984 hbcui1984 requested a review from chouchouji May 9, 2025 02:50
@chouchouji
Copy link
Contributor

chouchouji commented May 12, 2025

ios真机也有一样的问题,可以考虑一并修复

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

Successfully merging this pull request may close these issues.

2 participants