fix: explain a rejected dust threshold instead of snapping back silently (closes #233)
All checks were successful
check / check (push) Successful in 31s

The dust threshold field resynced to the stored value on a rejected input
and said nothing, so the box changed to a different number with no reason
given. It was the only validated input in the settings view that rejected
without a message.

Rejected input now shows one full sentence naming the constraint, using the
flash line already used by the RPC and Blockscout validation in the same
file. No layout shift: #flash-msg is always present with its height
reserved.

Hex and exponent notation are rejected rather than accepted. Number() reads
0x10 as 16 and 1e3 as 1000, which the earlier parseInt did not, and storing
either would put a number in the field that the user never typed - the same
silent substitution the message exists to end. Accepted input is plain
decimal digits only; the field is inputmode="numeric" and the unit is
printed beside it.

The parse moves to src/popup/dustThreshold.js, pure and unit tested, with
the message beside it so there is one wording. Tests cover the accepted set,
the rejected notations, that a rejection flashes the message and stores
nothing while a valid value stores and stays quiet, and that the flash line
reserves its height.
This commit is contained in:
2026-08-12 08:20:26 +00:00
parent ba35282092
commit 9c2f617ac0
5 changed files with 292 additions and 8 deletions

View File

@@ -811,7 +811,12 @@ of it.
- "Hide fake tokens impersonating a known symbol" checkbox
- "Hide tokens with fewer than 1,000 holders" checkbox
- "Hide transactions from detected fraud contracts" checkbox
- "Hide dust transactions below N gwei" checkbox + threshold input
- "Hide dust transactions below N gwei" checkbox + threshold input. The
threshold is plain decimal digits, a whole number of gwei, zero or
greater (zero hides nothing). Anything else — a fraction, a negative,
a value carrying its unit, hex (`0x10`) or exponent (`1e3`) notation —
is refused with a flash message and the field snaps back to the stored
threshold, so a number the user did not type is never stored.
- Allowed Sites: list with remove buttons
- Denied Sites: list with remove buttons
- About: project link, license, author, version, release date, and the