1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/ducks
Elliot Winkler bd12ea733a
Fix autolock field to accept decimals in Firefox (#19653)
The autolock field on the Settings screen — the field that allows users
to set the duration that MetaMask will wait for until automatically
locking — does not always accept decimal numbers. This breaks the e2e
test for this feature as it attempts to set this field to "0.1".

More specifically, the React component responsible for this field passes
whatever the user inputs through the `Number` function immediately and
then uses this to repopulate the input. Therefore, if the user enters
"3" followed by a ".", `Number("3.")` will be called. This evaluates to
the number 3, and "3" becomes the new value of the field. As a result,
the "." can never be typed.

Curiously, this behavior only happens in Firefox; Chrome seems to
keep the "." in the input field when it's typed. This happens because
`onChange` event doesn't seem to get fired until a number is typed
*after* the ".". This may be due to underlying differences in the DOM
between Chrome and Firefox.

Regardless, always passing the input through `Number` creates other odd
behavior, such as the fact that the input can never be cleared (because
`Number("")` evaluates to 0).

This commit solves these problems by saving the "raw" version of the
user's input as well as the normalized version. The raw version is
always used to populate the input, whereas the normalized version is
saved in state.
2023-06-22 10:29:24 -06:00
..
alerts feature: convert level 32 files to typescript (#17390) 2023-01-27 18:28:03 +00:00
app [FLASK] Add Snaps privacy warning on snap install (#18835) 2023-05-31 14:43:39 +02:00
confirm-transaction Rename provider to providerConfig (#18907) 2023-05-02 13:23:20 -02:30
gas feat(mme-17214): migrate L33 files to typescript (#17372) 2023-01-31 12:01:10 +00:00
history remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
institutional [MMI] Added compliance details modal and compliance details component (#18118) 2023-05-05 14:07:51 +02:00
locale Convert actions.js to typescript (#17446) 2023-02-03 11:56:44 -06:00
metamask Fix autolock field to accept decimals in Firefox (#19653) 2023-06-22 10:29:24 -06:00
send Rename provider to providerConfig (#18907) 2023-05-02 13:23:20 -02:30
swaps Swaps UI update (#19169) 2023-06-15 20:17:21 +02:00
domains.js Fix/use etherjs specific imports (#15461) 2023-01-24 08:10:36 -06:00
index.js feature: convert level 32 files to typescript (#17390) 2023-01-27 18:28:03 +00:00