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 #6837 - Updated onInputKeyDown() on InputNumber so that it works as expected #6845

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

Abassion
Copy link

Here is the Issue link that was fixed on this PR. The creator of the issue provided clear description of the issue.

Copy link

vercel bot commented Nov 23, 2024

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

2 Skipped Deployments
Name Status Preview Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2024 2:12pm
primevue-v3 ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2024 2:12pm

@@ -401,14 +402,20 @@ export default {
break;

case 'ArrowLeft':
if (!this.isNumeralChar(inputValue.charAt(selectionStart - 1))) {
if (selectionRange > 1) {
Copy link
Author

Choose a reason for hiding this comment

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

Previously, this switch case block was behaving as follows: if the character to the left of the current cursor position is not a numeral (or a valid part of the number format, such as a decimal point, grouping character, or minus sign), is to prevent the default action (cursor movement), This ensures that the user cannot accidentally move the cursor to the prefix for example.

However, this logic did not account for cases where there is a text selection, often occurring when users navigate between fields using the TAB key. In such cases, selectionStart would be 0, which coincides with the prefix (if provided). This resulted in the ArrowLeft and ArrowRight keys not working as expected, leaving users unable to properly adjust the cursor position.

@tugcekucukoglu tugcekucukoglu merged commit a2348d9 into primefaces:master Nov 25, 2024
2 of 3 checks passed
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