mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Improve slippage input validation in Swaps (#13914)
* Improve client-side validation for the slippage input * Improve validation of the slippage input field * Use Number instead of toNumber
This commit is contained in:
parent
466379b325
commit
5aff1863ca
@ -166,11 +166,15 @@ export default function SlippageButtons({
|
||||
>
|
||||
<input
|
||||
onChange={(event) => {
|
||||
setCustomValue(event.target.value);
|
||||
onSelect(Number(event.target.value));
|
||||
const { value } = event.target;
|
||||
const isValueNumeric = !isNaN(Number(value));
|
||||
if (isValueNumeric) {
|
||||
setCustomValue(value);
|
||||
onSelect(Number(value));
|
||||
}
|
||||
}}
|
||||
type="number"
|
||||
step="0.1"
|
||||
type="text"
|
||||
maxLength="4"
|
||||
ref={setInputRef}
|
||||
onBlur={() => {
|
||||
setEnteringCustomValue(false);
|
||||
|
Loading…
Reference in New Issue
Block a user