Skip to content

Commit bba7cd2

Browse files
committed
Tweak autocomp style and make auto-select behaviour configurable from the template.
1 parent f53adc4 commit bba7cd2

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

site/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ <h3 class="intro">
5757
</select>
5858
<div class="input-group">
5959
<input autofocus autocomplete="off" required placeholder="" aria-label="Search word"
60-
type="text" id="q" name="q" value="{{ if .Data.Query }}{{ .Data.Query.Query }}{{ end }}" />
60+
type="text" id="q" name="q" value="{{ if .Data.Query }}{{ .Data.Query.Query }}{{ end }}" data-autocomp-autoselect="false" />
6161
<button type="submit" aria-label="Search"><img src="/static/search.svg?v={{ .AssetVer }}" alt="{{- .L.T "global.btnSearch" -}}" /></button>
6262
</div>
6363
</div>

site/static/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ async function screenshotElement(element) {
272272
let debounce;
273273

274274
autocomp(elQ, {
275-
autoSelect: false,
275+
autoSelect: elQ.dataset.autocompAutoselect === "true",
276276
onQuery: async (val) => {
277277
const fromLang = localStorage.from_lang;
278278

site/static/style.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ button:hover,
640640

641641
/* Autocomplete */
642642
.autocomp {
643-
background: #f8f8f8;
643+
background: #ffffff;
644644
border-radius: 0 0 5px 5px;
645645
border: 1px solid #ccc;
646646
border-top: 0;
@@ -650,9 +650,10 @@ button:hover,
650650
}
651651

652652
.autocomp-item {
653-
padding-bottom: 5px;
653+
padding: 5px 10px;
654654
padding: 10px;
655655
cursor: pointer;
656+
border-bottom: 1px solid #eee;
656657
}
657658

658659
.autocomp-item:hover,

0 commit comments

Comments
 (0)