Autofocus search bar only on search homepage

This commit is contained in:
Samantaz Fox 2022-01-13 22:19:19 +01:00
parent 042ff8da64
commit 6cf6c56dd1
No known key found for this signature in database
GPG key ID: F42821059186176E
3 changed files with 4 additions and 4 deletions

View file

@ -1,8 +1,8 @@
<form class="pure-form" action="/search" method="get"> <form class="pure-form" action="/search" method="get">
<fieldset> <fieldset>
<input type="search" id="searchbox" autocomplete="off" autocorrect="off" <input type="search" id="searchbox" autocomplete="off" autocorrect="off"
autocapitalize="none" spellcheck="false" autofocus name="q" autocapitalize="none" spellcheck="false" <% if autofocus %>autofocus<% end %>
placeholder="<%= translate(locale, "search") %>" name="q" placeholder="<%= translate(locale, "search") %>"
title="<%= translate(locale, "search") %>" title="<%= translate(locale, "search") %>"
value="<%= env.get?("search").try {|x| HTML.escape(x.as(String)) } %>"> value="<%= env.get?("search").try {|x| HTML.escape(x.as(String)) } %>">
</fieldset> </fieldset>

View file

@ -14,7 +14,7 @@
</div> </div>
<div class="pure-u-1-4"></div> <div class="pure-u-1-4"></div>
<div class="pure-u-1 pure-u-md-12-24 searchbar"> <div class="pure-u-1 pure-u-md-12-24 searchbar">
<%= rendered "components/search_box" %> <% autofocus = true %><%= rendered "components/search_box" %>
</div> </div>
<div class="pure-u-1-4"></div> <div class="pure-u-1-4"></div>
</div> </div>

View file

@ -35,7 +35,7 @@
<a href="/" class="index-link pure-menu-heading">Invidious</a> <a href="/" class="index-link pure-menu-heading">Invidious</a>
</div> </div>
<div class="pure-u-1 pure-u-md-12-24 searchbar"> <div class="pure-u-1 pure-u-md-12-24 searchbar">
<%= rendered "components/search_box" %> <% autofocus = false %><%= rendered "components/search_box" %>
</div> </div>
<% end %> <% end %>