Fix numeric digit landing in decimal area when typed before prefix (#2615)#2881
Open
thorn0 wants to merge 1 commit intoRobinHerbots:5.xfrom
Open
Fix numeric digit landing in decimal area when typed before prefix (#2615)#2881thorn0 wants to merge 1 commit intoRobinHerbots:5.xfrom
thorn0 wants to merge 1 commit intoRobinHerbots:5.xfrom
Conversation
…obinHerbots#2615) When the cursor is placed before the prefix on a numeric mask with radixPoint, the DOM position translates past the buffer end, causing _isValid to fall through to alternation switching and place the digit in the decimal area (e.g. typing "5" produced "$0.5" instead of "$5"). Detect this case in preValidation and redirect to the integer part when the field has no entered digits. The check ignores positions populated by checkVal (generatedInput) and the negation symbol so the fix also applies after typing "-" alone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When the cursor is placed before the prefix on a numeric mask with
radixPoint, the DOM position translates past the buffer end, causing_isValidto fall through to alternation switching and place the digit in the decimal area (e.g. typing "5" produced "$0.5" instead of "$5").preValidationand redirect to the integer part when the field has no entered digitscheckVal(generatedInput) and the negation symbol, so the fix also applies after typing "-" aloneCloses #2615, closes #1367
Test plan
-digitsOptional: falsevariantradixPoint/groupSeparator"$ ") with cursor at 0 and mid-prefixAI disclosure
This PR was written primarily by Claude Code. Follow-up fixes were reviewed and amended by Codex.