From 096d44856fb219d467519dbfc3fc330fe49ac712 Mon Sep 17 00:00:00 2001 From: Zed Date: Sun, 27 Nov 2022 16:06:36 +0100 Subject: [PATCH] Remove Location field autofocus from search panel --- src/views/renderutils.nim | 4 ++-- src/views/search.nim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/renderutils.nim b/src/views/renderutils.nim index bab01cd..8e8d530 100644 --- a/src/views/renderutils.nim +++ b/src/views/renderutils.nim @@ -55,12 +55,12 @@ proc genCheckbox*(pref, label: string; state: bool): VNode = else: input(name=pref, `type`="checkbox") span(class="checkbox") -proc genInput*(pref, label, state, placeholder: string; class=""): VNode = +proc genInput*(pref, label, state, placeholder: string; class=""; autofocus=true): VNode = let p = placeholder buildHtml(tdiv(class=("pref-group pref-input " & class))): if label.len > 0: label(`for`=pref): text label - if state.len == 0: + if autofocus and state.len == 0: input(name=pref, `type`="text", placeholder=p, value=state, autofocus="") else: input(name=pref, `type`="text", placeholder=p, value=state) diff --git a/src/views/search.nim b/src/views/search.nim index 94bbac8..77ba14f 100644 --- a/src/views/search.nim +++ b/src/views/search.nim @@ -88,7 +88,7 @@ proc renderSearchPanel*(query: Query): VNode = genDate("until", query.until) tdiv: span(class="search-title"): text "Near" - genInput("near", "", query.near, placeholder="Location...") + genInput("near", "", query.near, "Location...", autofocus=false) proc renderTweetSearch*(results: Result[Tweet]; prefs: Prefs; path: string; pinned=none(Tweet)): VNode =