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

[@mantine/core] fix: NumberInput cursor position #6004

Merged
merged 3 commits into from Apr 11, 2024

Conversation

Kenzo-Wada
Copy link
Contributor

@Kenzo-Wada Kenzo-Wada commented Mar 30, 2024

Fixes: #6003

after
Screencast

useEffect(() => {
if (inputRef.current) {
const { length } = inputRef.current.value;
inputRef.current.setSelectionRange(length, length);
Copy link
Member

Choose a reason for hiding this comment

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

What if user wants to edit value in the middle, for example 251{cursor}213, when anything is entered the selection range is moved to the end – this is unexpected behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I've fixed this issue at f49af28. by this change, the position of cusor only changes when decrement/increment. I'll be happy if you check this change is Ok :)

@Kenzo-Wada Kenzo-Wada requested a review from rtivital April 2, 2024 14:42
@rtivital rtivital merged commit cff6b32 into mantinedev:master Apr 11, 2024
1 check passed
@rtivital
Copy link
Member

Thanks!

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.

NumberInput: position of cursor moves weird
2 participants