aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 11:48:58 -0700
committerAdam Soltys <[email protected]>2026-10-07 11:48:58 -0700
commit5b6cdd95a3769ba897ae845590c7cbff0096e532 (patch)
tree4228eb95fb0b809aee3c12d749c939fb28190b36 /src/app.js
parent3227fa8ca1ef57fff3e2242dc84899482ea9b260 (diff)
downloadcoinosv3-5b6cdd95a3769ba897ae845590c7cbff0096e532.tar.gz
coinosv3-5b6cdd95a3769ba897ae845590c7cbff0096e532.zip
Desktop: the Send amount field takes the cursor as soon as it appears (once; never off another field, never on phones)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/app.js')
-rw-r--r--src/app.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/app.js b/src/app.js
index 4f42529..0138de2 100644
--- a/src/app.js
+++ b/src/app.js
@@ -4674,6 +4674,23 @@ function tabsBar() {
);
}
+// On a desktop (a real pointer, a real keyboard) the amount field takes the
+// cursor the moment it appears, so a picked recipient goes straight to typing
+// the number. Once per field: it never pulls focus back after you've moved on,
+// and never off another field you're in (a zap comment) — only off nothing,
+// or off the recipient field that just resolved. Phones keep their keyboard
+// down until a tap.
+function focusSendAmount() {
+ if (matchMedia('(pointer: coarse)').matches) return;
+ const pane = document.querySelector('[data-send-pane]');
+ const amt = pane && pane.querySelector('input[type=number]:not(:disabled)');
+ if (!amt || amt._autoFocused) return;
+ amt._autoFocused = true;
+ const a = document.activeElement;
+ if (a && a !== document.body && !(a.classList && a.classList.contains('send-dest'))) return;
+ amt.focus();
+}
+
function tabContent() {
if (ui.tab === 'settings') return settingsTab();
if (ui.tab === 'history') return historyTab();
@@ -4688,7 +4705,10 @@ function tabContent() {
if (detailOpen) return hist;
sendFocused = false;
const pane = ui.tab === 'receive' ? receiveTab() : sendTab();
- if (ui.tab === 'send' && pane && pane.setAttribute) pane.setAttribute('data-send-pane', '');
+ if (ui.tab === 'send' && pane && pane.setAttribute) {
+ pane.setAttribute('data-send-pane', '');
+ requestAnimationFrame(focusSendAmount);
+ }
// Past the recipient — an amount to enter, a payment to confirm — the
// history is one more thing on screen while you're about to send.
if (ui.tab === 'send' && sendFocused) return pane;