MetaMask / MetaMask/metamask-extension

Use form-field component for input validation logic in custom-spending-cap.js

Open
#17,409 0 comments 0 reactions 1 assignee Claimed by @amerkadicE View on GitHub
team-confirmations-planning type-refactor
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.