templates/topbar: add required attribute to search input

If we press enter without any search value, we get directed to
/$PROJECT/$VERSION/A/ident/ which is a "400 Bad Request".

As the search input is selected by default, this is any enter press
where the focus hasn't changed.

`required` documentation:
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/required

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
This commit is contained in:
Théo Lebrun 2025-11-03 08:58:14 +01:00 committed by tleb
parent 89aef0d77b
commit 11b6632d5d

View file

@ -19,7 +19,7 @@
<div class="search-controls"> <div class="search-controls">
<input placeholder="Search Identifier" type="text" id="search-input" name="i" <input placeholder="Search Identifier" type="text" id="search-input" name="i"
value="{{ searched_ident|default('')|e }}" autofocus/> value="{{ searched_ident|default('')|e }}" autofocus required/>
<button type="button" id="clear-search" class="visible-if-js icon-cross"><span class="screenreader">Clear</span></button> <button type="button" id="clear-search" class="visible-if-js icon-cross"><span class="screenreader">Clear</span></button>
<button type="submit" class="icon-search"><span class="screenreader">Go get it</span></button> <button type="submit" class="icon-search"><span class="screenreader">Go get it</span></button>
</div> </div>