From f449fe8a3200f96f858dc07761241a97d3de5e8d Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Sat, 9 Jul 2022 12:29:54 -0700 Subject: [PATCH] Semantic/a11y markup improvements - Make search results an
    with an ARIA label. If more elements are erver present on the SERP (e.g. settings), the
      should be placed inside a
      and its label should move to that section too. - Remove list-style and padding from the
        in the stylesheet - Add the "search" ARIA role to the search form. - Make search result titles headings. This is established convention that assistive-technology users are already familiar with from other engines. - Add an indicator for "N search results found". This is where the list label comes from. - Exclude the brand name from machine translation. --- static/main.css | 5 +++++ templates/form.html | 5 +++-- templates/search.html | 25 ++++++++++++++++--------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/static/main.css b/static/main.css index 80a3306..d314976 100644 --- a/static/main.css +++ b/static/main.css @@ -113,6 +113,11 @@ h1 a { color: black; } +ol { + list-style-type: none; + padding: 0; +} + .input-group { display: flex; } diff --git a/templates/form.html b/templates/form.html index 7fcc93b..780a3fe 100644 --- a/templates/form.html +++ b/templates/form.html @@ -1,5 +1,5 @@ -
        -

        + +

        @@ -15,6 +15,7 @@ name="q" placeholder="Search terms..." autofocus + required value="{{.Query}}" /> diff --git a/templates/search.html b/templates/search.html index b8467c8..5ae0949 100644 --- a/templates/search.html +++ b/templates/search.html @@ -3,14 +3,21 @@ {{template "form.html" .}}
        - {{range .Results}} -
        - {{.Page.Title}} - {{.Page.Url}} - {{if .Page.Excerpt}} -

        {{.Page.Excerpt}}

        - {{end}} -
        - {{end}} +{{if .Results}} +

        {{len .Results}} search results found

        +
          + {{range .Results}} +
        1. +

          {{.Page.Title}}

          + {{.Page.Url}} + {{if .Page.Excerpt}} +

          {{.Page.Excerpt}}

          + {{end}} +
        2. + {{end}} +
        +{{else}} +

        No search results found

        +{{end}}
        {{template "footer.html" .}}