From ff0c7deafa20407d17869d218ff3c18b2aa4d7c7 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Wed, 13 Jul 2022 08:31:20 -0700 Subject: [PATCH] Make the skip-link point to h1 instead of main Link targets need to be focusable to work with VoiceOver. Making
focusable causes some side-effects, like making the TAB key go to the beginning of
instead of the element after the currently-clicked region. Also removes the annoying outline around "main" in some non-mainstream browsers, without having to add extra CSS. --- assets/css/main.css | 6 +++--- layouts/_default/404.html | 10 +++++++--- layouts/_default/bookmarks.html | 4 ++-- layouts/_default/list.html | 2 +- layouts/_default/search.html | 4 ++-- layouts/_default/single.html | 2 +- layouts/about/list.html | 2 +- layouts/index.html | 4 ++-- layouts/meta/list.html | 2 +- layouts/notes/single.html | 2 +- layouts/partials/full-article.html | 2 +- layouts/partials/header.html | 2 +- layouts/posts/single.html | 2 +- 13 files changed, 24 insertions(+), 20 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index 1e72a3e..a298753 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -152,7 +152,7 @@ html { margin: -.75em -.25em; } - header a[href="#main"], /* skip link */ + a[href="#h1"], /* skip link */ div[itemprop="comment"] dd > a , footer > nav, /* List items with direct hyperlink children should only have one hyperlink. */ @@ -187,13 +187,13 @@ html { } /* skip link: make it invisible until focused, and put it on the top. */ - header a[href="#main"] { + a[href="#h1"] { position: absolute; top: -2em; padding: 0 .25em; } - header a[href="#main"]:focus { + a[href="#h1"]:focus { top: 0; } } diff --git a/layouts/_default/404.html b/layouts/_default/404.html index 5f37ef6..48b21b2 100644 --- a/layouts/_default/404.html +++ b/layouts/_default/404.html @@ -14,7 +14,7 @@ {{ $resources = $resources | append (resources.Get "css/print.css" | resources.ExecuteAsTemplate "print.css" .) -}} {{- $css := $resources | resources.Concat "css/style.css" | minify -}} - + {{ .Title }} {{ if not (in site.BaseURL ".onion") -}} {{ $icon_svg := resources.Get "/favicon.svg" | resources.Fingerprint "md5" }} @@ -28,6 +28,7 @@
+ Skip to content
-

{{ .Title }}

+

{{ .Title }}

{{ partial "processed-content.html" . -}}