MetaMask / MetaMask/metamask-extension
Use form-field component for input validation logic in custom-spending-cap.js
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
In https://github.com/MetaMask/metamask-extension/pull/17117, code was added to validate the input in custom-spending-cap.js, in particular to prevent entering letters in an input that expects numbers.
Also, that component has logic that limits the number of decimals that can be entered in the field, and for handling the entering of commas.
All of these behaviours of the input field should be moved in the FormField component it relies on. We don't want to duplicate this logic next time we create a numeric field, and behaviour like this can be delicate, so we should have good tests for it in one place.
Also, while investigating this, it was discovered that the form-field component is partially broken when its `numeric` property is used. https://github.com/MetaMask/metamask-extension/pull/17117#issuecomment-1378544065 This needs to be fixed as well
Contributor guide
Assessment
This issue has not been assessed yet.