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

fix(input-number): when zero is entered, value displayed isn't expected #4747

Merged
merged 3 commits into from
Jan 18, 2024

Conversation

betavs
Copy link
Contributor

@betavs betavs commented Nov 3, 2023

Fix #4539

Copy link

vercel bot commented Nov 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Jan 17, 2024 7:16am

@betavs
Copy link
Contributor Author

betavs commented Nov 3, 2023

If this solution works, I'll optimize the code again.

@tugcekucukoglu
Copy link
Member

It breaks the Horizontal with Step demo. Firstly delete all input and type some number and then try to type '.'. And compare the behavior with live demo.

@tugcekucukoglu tugcekucukoglu added the Resolution: Needs Revision The pull request can't be merged. Conflicts need to be corrected or documentation and code updated. label Nov 16, 2023
@betavs betavs force-pushed the hotfix/input-number-abnormal branch from 6884a1c to 60b3806 Compare November 17, 2023 09:20
@betavs
Copy link
Contributor Author

betavs commented Nov 17, 2023

It breaks the Horizontal with Step demo. Firstly delete all input and type some number and then try to type '.'. And compare the behavior with live demo.

Okay, I've made the adjustments.

@tugcekucukoglu
Copy link
Member

Thanks for your updates. This time it breaks Germany currency. First, delete all the input, type some numbers, then type ,. The second step of the currency will not change anymore.

@betavs
Copy link
Contributor Author

betavs commented Dec 13, 2023

Thanks for your updates. This time it breaks Germany currency. First, delete all the input, type some numbers, then type ,. The second step of the currency will not change anymore.

Okay, I think making these adjustments should solve the problem.

const re = /[.,]/g;
const newSelectionEnd = selectionEnd + Number(re.test(value) || re.test(insertedValueStr));

this.$refs.input.$el.setSelectionRange(newSelectionEnd, newSelectionEnd);

@mertsincan mertsincan added this to the 3.47.0 milestone Jan 16, 2024
@mertsincan mertsincan removed this from the 3.47.0 milestone Jan 16, 2024
@tugcekucukoglu
Copy link
Member

I'm sorry for not getting back to you sooner. The last updates are working as desired. We're planning to add this PR for the next version. If you add the update, we gladly merge it.

@tugcekucukoglu tugcekucukoglu merged commit 9a27f6b into primefaces:master Jan 18, 2024
2 of 3 checks passed
@tugcekucukoglu tugcekucukoglu removed the Resolution: Needs Revision The pull request can't be merged. Conflicts need to be corrected or documentation and code updated. label Jan 18, 2024
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.

InputNumber: insert behavior defects
3 participants