Fix the bug of textarea with maxlength can't input before limit #3044
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤔 这个 PR 的性质是?
🔗 相关 Issue
#3041
💡 需求背景和解决方案
背景:用户提出issue,反馈设置maxlength后,windows自带输入法,当输入中文时所输入字符还没有达到最大长度也会没法输入。
问题描述:textarea公共组件做输入字符限制时,每次 input 事件触发时剪切输入值以符合最大长度。这种剪切假设了所有字符将键入的同时变成结果字符,也就是说,如果用户正在输入一个长拼音字符序列(比如汉字的拼音),但还没有选择对应的汉字结果,输入就会被提前剪切,因为拼音可能会超过最大长度。
解决方案:用户在构词状态时不应该设置输入限制和字符剪切,而是等完成后。
📝 更新日志
fix(Textarea): 修复设置
maxlength
后,在windows自带输入法中,中文时不到最大长度也会自动覆盖之前已输入内容的缺陷本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单