diff options
author | Alan Pearce | 2024-05-17 13:31:03 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-17 13:58:29 +0200 |
commit | 054d2b3bf7eb4c5a5401565e86031f22ea754062 (patch) | |
tree | 7f8b883b5ce8374d949004e4588395f90b2bbc3b /frontend/templates/blocks | |
parent | d6e117bb9aeb2bae23dedd51b59b6e6f139e8a4f (diff) | |
download | searchix-054d2b3bf7eb4c5a5401565e86031f22ea754062.tar.lz searchix-054d2b3bf7eb4c5a5401565e86031f22ea754062.tar.zst searchix-054d2b3bf7eb4c5a5401565e86031f22ea754062.zip |
feat: improve accessibility and browser behaviour
Diffstat (limited to 'frontend/templates/blocks')
-rw-r--r-- | frontend/templates/blocks/options.gotmpl | 2 | ||||
-rw-r--r-- | frontend/templates/blocks/results.gotmpl | 8 | ||||
-rw-r--r-- | frontend/templates/blocks/search.gotmpl | 16 |
3 files changed, 18 insertions, 8 deletions
diff --git a/frontend/templates/blocks/options.gotmpl b/frontend/templates/blocks/options.gotmpl index 806ca2f..de31696 100644 --- a/frontend/templates/blocks/options.gotmpl +++ b/frontend/templates/blocks/options.gotmpl @@ -3,7 +3,7 @@ {{- with .Data }} <details id="{{ .Name }}"> <summary> - {{ .Name }} + <h3>{{ .Name }}</h3> </summary> {{ markdown .Description }} <dl> diff --git a/frontend/templates/blocks/results.gotmpl b/frontend/templates/blocks/results.gotmpl index 95c89ca..c375156 100644 --- a/frontend/templates/blocks/results.gotmpl +++ b/frontend/templates/blocks/results.gotmpl @@ -1,10 +1,10 @@ {{- define "results" }} {{- with .Results }} {{- if gt .Total 0 }} - <section id="results"> + <section id="results" role="list" aria-label="search results"> {{ block "hits" .Hits }} {{ end }} - <footer> + <footer aria-label="pagination"> <nav id="pagination"> {{- with $.Prev }} <a class="button" href="{{ . }}" rel="prev">Prev</a> @@ -13,11 +13,11 @@ <a class="button" href="{{ . }}" rel="next">Next</a> {{- end }} </nav> - <span>{{ .Total }} results</span> + <span role="status">{{ .Total }} results</span> </footer> </section> {{- else }} - Nothing found + <span role="status">Nothing found</span> {{- end }} {{- end }} {{- end }} diff --git a/frontend/templates/blocks/search.gotmpl b/frontend/templates/blocks/search.gotmpl index 6f47df3..1be001a 100644 --- a/frontend/templates/blocks/search.gotmpl +++ b/frontend/templates/blocks/search.gotmpl @@ -1,8 +1,18 @@ {{- define "main" }} - <form id="search"> - <label for="query">{{ .Source.Name }} option search</label> + <form id="search" role="search"> <fieldset> - <input id="query" name="query" type="search" value="{{ .Query }}" /> + <legend id="legend"> + <h2>{{ sourceNameAndType .Source }} search</h2> + </legend> + <input + id="query" + aria-labelledby="legend" + name="query" + type="search" + value="{{ .Query }}" + autofocus + spellcheck="false" + /> <button>Search</button> </fieldset> </form> |