1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00
metamask-extension/app/scripts
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
..
account-import-strategies Upgrading the Import Account modal (#17763) 2023-03-06 09:48:28 -08:00
constants Convert app/scripts/constants -> Typescript (#17327) 2023-01-20 13:33:01 -07:00
controllers Fix autolock field to accept decimals in Firefox (#19653) 2023-06-22 10:29:24 -06:00
lib [MMI] renames method for better understanding (#19622) 2023-06-15 23:33:28 +01:00
migrations Upgrade assets-controllers to v9 (#19472) 2023-06-09 15:48:48 -05:00
platforms Support translation in background code (#19650) 2023-06-20 13:44:11 +01:00
app-init.js Fix firsttimeloaded logic (#18344) 2023-04-06 12:13:01 -02:30
background.js Await approval request in transaction controller (#19197) 2023-06-13 10:17:32 +01:00
contentscript.js Update the PhishingController to v2 and update phishing warning page (#17835) 2023-02-24 11:39:00 -03:30
detect-multiple-instances.js Warn about multiple MetaMask instances running (#13836) 2022-04-27 20:14:10 +02:00
detect-multiple-instances.test.js [MMI] Prevent multiple instances of MM at the same browser (#17856) 2023-03-02 10:17:45 -06:00
disable-console.js Update Eslint and deps (#15293) 2022-07-26 13:10:51 -05:00
first-time-state.js Migrate network configurations (previously frequentRpcListDetail) from PreferencesController to NetworkController (#17421) 2023-03-09 15:00:28 -06:00
init-globals.js MV3: fix injection of applyLavamoat variable in service worker (#14920) 2022-06-18 12:40:30 +05:30
inpage.js MV3: contentscript.js - re-activate streams when Service Worker terminates and then resets (#15494) 2022-09-13 14:20:08 -07:00
lockdown-more.js Activate LavaMoat scuttling security feature (#17276) 2023-01-24 19:00:35 +02:00
lockdown-run.js update ses@0.18.4 (#17521) 2023-04-27 21:31:52 +09:00
metamask-controller.actions.test.js Await approval request in transaction controller (#19197) 2023-06-13 10:17:32 +01:00
metamask-controller.js Accept SignController approval request from frontend (#19184) 2023-06-20 15:37:09 +02:00
metamask-controller.test.js Fix flakey tests in metamask controller tests (#19312) 2023-06-14 15:38:40 -04:00
mmi-keyring-builder-factory.js [MMI] adds mmi code fences to mm controller (#18279) 2023-05-29 16:38:28 +01:00
sentry-install.js refactor sentryHooks object (#16435) 2022-11-09 19:28:32 +00:00
translate.test.ts Support translation in background code (#19650) 2023-06-20 13:44:11 +01:00
translate.ts Support translation in background code (#19650) 2023-06-20 13:44:11 +01:00
ui.js feat: add yaml feature management (#18125) 2023-04-25 16:32:51 +02:00
use-snow.js Integrating snow into metamask (#15580) 2022-11-24 02:36:19 +02:00