Przeglądaj źródła

Remove Location field autofocus from search panel

Zed 3 lat temu
rodzic
commit
096d44856f
2 zmienionych plików z 3 dodań i 3 usunięć
  1. 2 2
      src/views/renderutils.nim
  2. 1 1
      src/views/search.nim

+ 2 - 2
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)

+ 1 - 1
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 =