From 6f62c8c1390d00570aac5ee8b253617b8242e46a Mon Sep 17 00:00:00 2001 From: Jonathan Sykes Date: Thu, 15 Oct 2026 11:15:40 +0800 Subject: [PATCH] Don't open recent searches on start-up focus; no auto-focus on touch devices --- frontend/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/app.js b/frontend/app.js index 37729d1..64ca8ef 100755 --- a/frontend/app.js +++ b/frontend/app.js @@ -7961,7 +7961,10 @@ function wireUI() { els.searchRecent.classList.remove('hidden'); } function hideRecentSearches() { els.searchRecent.classList.add('hidden'); } - els.searchInput.addEventListener('focus', showRecentSearches); + // Only a user's own focus opens the list, never the start-up focus below. + els.searchInput.addEventListener('focus', () => { if (!els.searchInput._bootFocus) showRecentSearches(); }); + // Already focused (start-up) — a click or tap on the box still opens it. + els.searchInput.addEventListener('pointerdown', () => { if (document.activeElement === els.searchInput) showRecentSearches(); }); els.searchInput.addEventListener('input', () => { if (els.searchInput.value.trim()) hideRecentSearches(); else showRecentSearches(); }); @@ -9440,7 +9443,12 @@ async function boot() { checkAutoBackup(); render(); - els.searchInput.focus(); + // Ready to type on desktop; on touch devices focusing would pop the keyboard. + if (!matchMedia('(pointer: coarse)').matches) { + els.searchInput._bootFocus = true; + els.searchInput.focus({ preventScroll: true }); + els.searchInput._bootFocus = false; + } // Register service worker + ping server with fingerprint (WEB mode only) if (WEB) checkUpdateOutcome();