1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00
metamask-extension/shared/constants
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
..
snaps Fence snaps endowments and permissions for stable/flask (#18847) 2023-05-02 14:51:16 +02:00
alarms.js Replace setInterval with chrome alarms for MetaMetrics FinalizeEventFragment (#16003) 2022-10-04 13:03:50 -04:00
alerts.ts feature: convert level 32 files to typescript (#17390) 2023-01-27 18:28:03 +00:00
app.ts feat: add yaml feature management (#18125) 2023-04-25 16:32:51 +02:00
bridge.ts Show Bridge button in TokenOverview component (#18630) 2023-04-20 23:57:18 -02:30
common.ts add numeric module (#17324) 2023-01-20 15:16:56 -06:00
desktop.ts Add extension desktop UI (#17748) 2023-02-23 16:39:48 +00:00
gas.ts When gas fees suggested by dapp is too high, show warning color and icon (#19088) 2023-06-08 13:26:18 +03:00
hardware-wallets.ts Update keystone links (#18792) 2023-04-25 21:33:43 +08:00
keyring.ts Refactor KeyringTypes constant (#17490) 2023-03-21 12:13:22 -02:30
labels.ts Convert shared/constants/labels.js -> Typescript (#17309) 2023-01-20 08:02:09 -06:00
metametrics.ts feature(on-ramp): update supported networks (#19268) 2023-06-02 08:19:03 -04:00
network.ts feat: add new linea mainnet network (#19326) 2023-06-16 14:05:33 -02:30
permissions.test.js [FLASK] snaps@0.34.0-flask.1 (#19377) 2023-06-05 13:51:19 +02:00
permissions.ts Fence snaps endowments and permissions for stable/flask (#18847) 2023-05-02 14:51:16 +02:00
preferences.ts Fix autolock field to accept decimals in Firefox (#19653) 2023-06-22 10:29:24 -06:00
smartTransactions.js Swaps / STX improvements (#14622) 2022-05-09 18:48:14 +02:00
snaps.ts feat: add yaml feature management (#18125) 2023-04-25 16:32:51 +02:00
swaps.ts Swaps UI update (#19169) 2023-06-15 20:17:21 +02:00
terms.js [FLASK] Update Snaps privacy notice (#19501) 2023-06-09 14:22:31 +02:00
test-flags.js Introduce action metrics for mv3 service worker restart (#18346) 2023-03-31 14:22:33 +01:00
time.ts Add initial Typescript Files (#15596) 2022-08-16 10:15:29 -05:00
tokens.js Fixing error when user input some letter in token allowance flow (#17117) 2023-01-18 10:53:10 +01:00
transaction.ts [MMI] adds mmi code fences to mm controller (#18279) 2023-05-29 16:38:28 +01:00