Altinn / Altinn/app-frontend-react
Data with letters can be pasted into Input fields with a number formatting
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 33
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 3
Description
### Description of the bug
When testing an Input component with a number formatting and suffix I was able to paste in data that had a letters in it which meant that instead of only saving the numerical part of the data pasted it also saved the letters.
### Steps To Reproduce
1. Add an Input field to the form with the following properties:
```json
"formatting": {
"number": {
"suffix": " liter"
}
```
2. The dataModelBinding of the Input field should refer to a field that is a `string`.
3. Copy some some data such as "20 liter" and paste it into the field.
4. See that the string "20 liter" is saved instead of only "20".
### Additional Information
Here is a video showing the bug:
https://github.com/user-attachments/assets/d4bc0d73-1f36-4f9a-af05-f0da14623dd5
Contributor guide
Research direction
Start at the Input component's number-formatting and paste-handling entry points, using the reproduction configuration in the issue. Reproduce by pasting "20 liter" into a string-bound field with the " liter" suffix, then verify that only "20" is saved. Add regression coverage wherever the Input formatting behavior is tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100