1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/pages/settings
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
..
advanced-tab Fix autolock field to accept decimals in Firefox (#19653) 2023-06-22 10:29:24 -06:00
alerts-tab Replaced all fa-icon-circle with INFO icon (#17539) 2023-05-09 23:04:58 +05:30
contact-list-tab Send flow UI update (#19465) 2023-06-08 22:39:39 +05:30
experimental-tab Changes in blockaid texts (#19001) 2023-05-04 23:51:46 +05:30
info-tab [MMI] Added code fencing in libs folder (#17929) 2023-06-02 18:40:58 +02:00
networks-tab feat: add new linea mainnet network (#19326) 2023-06-16 14:05:33 -02:30
security-tab feat(srp): add a quiz to the SRP reveal (#19283) 2023-06-20 14:27:10 -04:00
settings-search UX Multichain: updated ui for settings page (#19167) 2023-05-23 23:59:00 +05:30
settings-search-list update icons to ts enum version (#18698) 2023-04-24 09:19:19 -05:00
settings-tab Update settings-tab.component.js (#18753) 2023-04-25 08:27:19 -05:00
snaps [FLASK] Rework Snaps headers and footers (#19442) 2023-06-07 15:18:49 +02:00
index.js remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
index.scss UX Multichain: UI fixes for settings page (#19574) 2023-06-13 20:47:35 +05:30
settings.component.js UX Multichain: UI fixes for settings page (#19574) 2023-06-13 20:47:35 +05:30
settings.container.js RFC: sort keys rule and initial changes (#15534) 2022-08-15 12:41:29 -05:00
settings.stories.js Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
settings.test.js UX Multichain: updated ui for settings page (#19167) 2023-05-23 23:59:00 +05:30