From b799686cd43ceb674c0b8cd741da8c383f890ae7 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 28 Feb 2026 14:18:28 -0800 Subject: [PATCH] fix: zero-tx warning layout shift and contract address false positive - Reserve space for the warning upfront using visibility:hidden instead of display:none, preventing layout shift per README policy - Move warning HTML to index.html as a static element rather than injecting dynamically - Skip warning for contract addresses (check getCode first) since getTransactionCount only returns outgoing tx nonce - Collapse reserved space when warning is not needed (address has history, is a contract, or on RPC error) --- src/popup/index.html | 13 +++++++++++++ src/popup/views/confirmTx.js | 34 +++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/popup/index.html b/src/popup/index.html index 5c9d444..c77bd37 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -577,6 +577,19 @@
+ `; - if (warningsEl.classList.contains("hidden")) { - warningsEl.innerHTML = warning; - warningsEl.classList.remove("hidden"); - } else { - warningsEl.innerHTML += warning; - } + el.style.visibility = "visible"; + } else { + // Address has history — collapse the reserved space + el.style.display = "none"; } } catch (e) { log.errorf("recipient history check failed:", e.message); + // On error, collapse the reserved space rather than showing a + // false warning or leaving an empty gap + el.style.display = "none"; } }