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

TextArea: e.target.setSelectionRange not work #49016

Closed
OCISHY opened this issue May 22, 2024 · 8 comments · Fixed by react-component/input#70
Closed

TextArea: e.target.setSelectionRange not work #49016

OCISHY opened this issue May 22, 2024 · 8 comments · Fixed by react-component/input#70

Comments

@OCISHY
Copy link

OCISHY commented May 22, 2024

Reproduction link

Edit on StackBlitz

Steps to reproduce

在输入框中输入内容 onChange中执行 setSelectionRange 不会重置光标位置

What is expected?

希望 setSelectionRange 生效,可以充值光标位置

What is actually happening?

setSelectionRange 不生效

Environment Info
antd 5.17.3
React 18.3.1
System MacOS
Browser Chrome

在 antd@5.6.1 中 setSelectionRange 和 selectionStart 都可以工作,在antd@5.12.7 中两者都不能工作,在最新版 antd@5.17.3 中selectionStart 正常, 应该和 issue #47779 问题类似

Copy link

stackblitz bot commented May 22, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@OCISHY
Copy link
Author

OCISHY commented May 22, 2024

效率真快 赞👍

@OCISHY
Copy link
Author

OCISHY commented May 29, 2024

antd 5.17.4 里面 rc-textarea 1.7.0 还是依赖的 rc-input 1.5.0, 大佬能不能把input相关的 rc-input依赖都更新到1.5.1 @zombieJ

@afc163
Copy link
Member

afc163 commented May 29, 2024

@OCISHY 移除 lock 文件重新安装 node_modules 即可。

@OCISHY
Copy link
Author

OCISHY commented May 29, 2024

https://github.com/react-component/textarea/blob/master/package.json
textarea 库依赖的还是 rc-input 1.5.0
81716963914_ pic

@afc163
Copy link
Member

afc163 commented May 29, 2024

~1.5.0 是包含 1.5.1 的,你按照我的建议做操作了么?

@yoyo837
Copy link
Contributor

yoyo837 commented May 29, 2024

lock和node_moduels都要删

@OCISHY
Copy link
Author

OCISHY commented May 29, 2024

解决了 thx 是因为组件 peerdep 的 rc-input没带~符号

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

Successfully merging a pull request may close this issue.

3 participants