1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00
metamask-extension/app/scripts/controllers
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
..
ens Fix/use etherjs specific imports (#15461) 2023-01-24 08:10:36 -06:00
network Copy missing lookupNetwork-related tests from core (#19431) 2023-06-21 13:52:01 -06:00
permissions Make eth_accounts return all permitted accounts (#18516) 2023-06-08 13:01:43 -07:00
transactions feat: add new linea mainnet network (#19326) 2023-06-16 14:05:33 -02:30
alert.js feature: convert level 32 files to typescript (#17390) 2023-01-27 18:28:03 +00:00
app-state.js Fix autolock field to accept decimals in Firefox (#19653) 2023-06-22 10:29:24 -06:00
app-state.test.js [FLASK] Add Snaps privacy warning on snap install (#18835) 2023-05-31 14:43:39 +02:00
backup.js Migrate network configurations (previously frequentRpcListDetail) from PreferencesController to NetworkController (#17421) 2023-03-09 15:00:28 -06:00
backup.test.js Migrate network configurations (previously frequentRpcListDetail) from PreferencesController to NetworkController (#17421) 2023-03-09 15:00:28 -06:00
cached-balances.js remove exclusions for mismatched object jsdoc type casing (#15351) 2022-07-27 08:28:05 -05:00
cached-balances.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
decrypt-message.test.ts Consume Decrypt Message Manager from @metamask/message-manager (#18379) 2023-04-26 17:02:33 +02:00
decrypt-message.ts Accept SignController approval request from frontend (#19184) 2023-06-20 15:37:09 +02:00
detect-tokens.js Rename provider to providerConfig (#18907) 2023-05-02 13:23:20 -02:30
detect-tokens.test.js Upgrade assets-controllers to v9 (#19472) 2023-06-09 15:48:48 -05:00
encryption-public-key.test.ts Return state when calling EncryptionPublicKeyController.cancelEncryptionPublicKey (#18845) 2023-04-27 11:39:37 +01:00
encryption-public-key.ts Accept SignController approval request from frontend (#19184) 2023-06-20 15:37:09 +02:00
incoming-transactions.js Additional incoming transactions support (#14219) 2023-02-14 12:35:42 -06:00
incoming-transactions.test.js Additional incoming transactions support (#14219) 2023-02-14 12:35:42 -06:00
metametrics.js [MMI] Added code fences to the following controllers: app-state, metametrics, preferences (#17894) 2023-05-23 16:16:23 +02:00
metametrics.test.js Upgrade assets-controllers to v9 (#19472) 2023-06-09 15:48:48 -05:00
mmi-controller.js MMI start script and fixes a bug preventing it to run (#19594) 2023-06-15 17:57:35 +01:00
mmi-controller.test.js [MMI] adds mmi code fences to mm controller (#18279) 2023-05-29 16:38:28 +01:00
onboarding.js Use async/await instead of Promise.resolve (#16221) 2023-01-20 14:20:18 -06:00
preferences.js feat: add new linea mainnet network (#19326) 2023-06-16 14:05:33 -02:30
preferences.test.js Make network controller internal fields private (#18607) 2023-04-17 12:45:33 -02:30
swaps.js Swaps UI update (#19169) 2023-06-15 20:17:21 +02:00
swaps.test.js Fix swaps controller: update provider after networkIdStore state update (#18670) 2023-04-19 18:15:26 -02:30