Skip to content

feat: fuzzier number matching for NumberParser #8592

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

snowystinger
Copy link
Member

@snowystinger snowystinger commented Jul 21, 2025

Closes #7015, Closes #3862, Closes #6861, Closes #5927

Finally had some thoughts on how to address some of the issues that were being tackled in #6520

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Try pasting numbers with group/decimal characters that are opposite of what the current formatting expects. Note, this is an improvement, there are some cases we can reasonably handle, then there are those which are still ambiguous.

For example, if there are two symbols in use, one is before the other, it's reasonable to assume that the first one is group and the second is decimal.
Or if there are multiple of one symbol, but only one of the other, then it's reasonable to assume that the symbol with multiple instances is the group, and the symbol with only one instance is the decimal.

On the other side, ambiguous cases are if there is only one symbol in use, we cannot reasonably know if it's a partial number with a group separator vs a decimal symbol. At least, I have determined a good way to figure this one out.

One other note, this does not extend to units/currency symbols. Those are literal and should not be fuzzy matched/removed. For example, pasting €10 into a currency formatted numberfield should not become $10 just because the formatting is for USD. They are not equivalent.

🧢 Your Project:

@rspbot
Copy link

rspbot commented Jul 21, 2025

@rspbot
Copy link

rspbot commented Jul 21, 2025

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