From f1f307388efd7b8841e588d2d6133520e2d049fc Mon Sep 17 00:00:00 2001 From: Ulas Kalayci Date: Thu, 30 Apr 2026 09:10:30 +0200 Subject: [PATCH] ux: hide search kbd hint after first keyboard use (long loop) --- public/router.js | 12 +++++++++++- public/styles/layout.css | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/public/router.js b/public/router.js index 678f53b..773b0ae 100644 --- a/public/router.js +++ b/public/router.js @@ -627,13 +627,23 @@ function renderAppShell(container) { initNavHideOnScroll(container); initOfflineBanner(); initKeyboardShortcuts(); + if (localStorage.getItem(SEARCH_KBD_KEY)) { + document.documentElement.classList.add('search-kbd-done'); + } } const FAB_SEEN_KEY = 'oikos:fabSeenCount'; const FAB_SEEN_MAX = 5; +const SEARCH_KBD_KEY = 'oikos:searchKbdUsed'; const SHORTCUTS = [ - { key: '/', description: () => t('shortcuts.search'), action: () => document.getElementById('more-sheet-search')?.click() }, + { key: '/', description: () => t('shortcuts.search'), action: () => { + if (!localStorage.getItem(SEARCH_KBD_KEY)) { + localStorage.setItem(SEARCH_KBD_KEY, '1'); + document.documentElement.classList.add('search-kbd-done'); + } + document.getElementById('more-sheet-search')?.click(); + } }, { key: 'n', description: () => t('shortcuts.new'), action: () => document.querySelector('.page-fab')?.click() }, { key: '?', description: () => t('shortcuts.help'), action: () => showShortcutsModal() }, { key: 'g d', description: () => t('shortcuts.goDash'), action: () => navigate('/') }, diff --git a/public/styles/layout.css b/public/styles/layout.css index f01e906..63ea12d 100755 --- a/public/styles/layout.css +++ b/public/styles/layout.css @@ -305,7 +305,7 @@ } @media (min-width: 1024px) { - .more-sheet__search-kbd { + html:not(.search-kbd-done) .more-sheet__search-kbd { display: inline; } }