1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-19 20:02:10 +00:00

Add skip-link

This one is simpler than the last attempt, since it doesn't overlap with
any content except the navbar links' empty padding.
This commit is contained in:
Rohan Kumar 2022-07-07 08:52:55 -07:00
parent 1a928a4807
commit 297ad1e5cb
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
11 changed files with 32 additions and 10 deletions

View file

@ -145,9 +145,9 @@ html {
margin: -.75em -.25em; margin: -.75em -.25em;
} }
header a[href="#main"],
div[itemprop="comment"] dd > a , div[itemprop="comment"] dd > a ,
footer > nav, footer > nav,
header > nav,
/* List items with direct hyperlink children should only have one hyperlink. */ /* List items with direct hyperlink children should only have one hyperlink. */
li > a, li > a,
aside > a, aside > a,
@ -156,6 +156,12 @@ html {
display: inline-block; display: inline-block;
} }
/* The nav has to be distant-enough from the top to make room for a skip-link. */
header > nav {
margin: .75em 0 0 -.25em;
display: block;
}
/* Multiple consecutive <dt> that share a <dd> shouldn't have tap targets overlap */ /* Multiple consecutive <dt> that share a <dd> shouldn't have tap targets overlap */
dt + dt > a { dt + dt > a {
padding-top: 0; padding-top: 0;
@ -176,6 +182,16 @@ html {
section[role="doc-endnotes"] li { section[role="doc-endnotes"] li {
margin-bottom: 1.75em; margin-bottom: 1.75em;
} }
header a[href="#main"] {
position: absolute;
top: -2em;
padding: 0 .25em;
}
header a[href="#main"]:focus {
top: 0;
}
} }
/* narrow screens: reduce list indentation, hyphenate nested lists /* narrow screens: reduce list indentation, hyphenate nested lists

View file

@ -7,7 +7,7 @@
} }
/* Hide screen-only content */ /* Hide screen-only content */
header a[href="#main"], /* Skip link */
aside:not([role="note"]), aside:not([role="note"]),
/* An un-opened summary inside an article has no use in print. /* An un-opened summary inside an article has no use in print.
* Outside an article it's used in my webring list where it has some * Outside an article it's used in my webring list where it has some

View file

@ -1,5 +1,6 @@
{{ define "main" -}} {{ define "main" -}}
<main itemprop="mainEntity" class="h-feed hfeed" itemscope="" itemtype="https://schema.org/DataFeed"> <main id="main" tabindex="-1"
itemprop="mainEntity" class="h-feed hfeed" itemscope="" itemtype="https://schema.org/DataFeed">
<h1 id="bookmarks" class="p-name" itemprop="name headline">My book&#173;marks</h1> <h1 id="bookmarks" class="p-name" itemprop="name headline">My book&#173;marks</h1>
{{ partial "processed-content.html" . }} {{ partial "processed-content.html" . }}
<p role="doc-tip"> <p role="doc-tip">

View file

@ -1,5 +1,6 @@
{{ define "main" -}} {{ define "main" -}}
<main itemprop="mainEntity" class="h-feed hfeed" itemscope="" itemtype="https://schema.org/DataFeed"> <main id="main" tabindex="-1"
itemprop="mainEntity" class="h-feed hfeed" itemscope="" itemtype="https://schema.org/DataFeed">
{{ partial "processed-content.html" . }} {{ partial "processed-content.html" . }}
<p role="doc-tip"> <p role="doc-tip">
Timestamp format: <code>YYYY-MM-DD HH:MM</code>, as per <cite><a href="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a></cite>. Sorted newest to oldest. Timestamp format: <code>YYYY-MM-DD HH:MM</code>, as per <cite><a href="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a></cite>. Sorted newest to oldest.

View file

@ -1,6 +1,6 @@
{{ define "main" -}} {{ define "main" -}}
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }} {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
<main > <main id="main" tabindex="-1">
<h1>Search</h1> <h1>Search</h1>
<p role="note">This page is an unfinished work-in-progress.</p> <p role="note">This page is an unfinished work-in-progress.</p>
{{ partial "search.html" . }} {{ partial "search.html" . }}

View file

@ -1,6 +1,7 @@
{{ define "main" -}} {{ define "main" -}}
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }} {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
<main itemprop="mainEntity" itemscope="" itemtype="https://schema.org/Article" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}"> <main id="main" tabindex="-1"
itemprop="mainEntity" itemscope="" itemtype="https://schema.org/Article" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">
{{ partial "full-article.html" . }} {{ partial "full-article.html" . }}
</main> </main>
{{ end }} {{ end }}

View file

@ -1,6 +1,6 @@
{{ define "main" -}} {{ define "main" -}}
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }} {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
<main> <main id="main" tabindex="-1">
{{- $articleTag := printf `<article class="h-entry hentry" itemprop="mainEntity" itemscope="" itemtype="https://schema.org/Article" itemid="%s%s">` .Site.Params.CanonicalBaseURL $canonicalRelPermalink -}} {{- $articleTag := printf `<article class="h-entry hentry" itemprop="mainEntity" itemscope="" itemtype="https://schema.org/Article" itemid="%s%s">` .Site.Params.CanonicalBaseURL $canonicalRelPermalink -}}
{{ partial "full-article.html" . | replaceRE `<article class="h-entry hentry">` $articleTag | safeHTML }} {{ partial "full-article.html" . | replaceRE `<article class="h-entry hentry">` $articleTag | safeHTML }}
<hr /> <hr />

View file

@ -1,5 +1,5 @@
{{ define "main" -}} {{ define "main" -}}
<main> <main id="main" tabindex="-1">
{{ partial "processed-content.html" . }} {{ partial "processed-content.html" . }}
{{ partial "posts.html" . }} {{ partial "posts.html" . }}
{{ partial "webrings.html" . }} {{ partial "webrings.html" . }}

View file

@ -1,6 +1,7 @@
{{- define "main" -}} {{- define "main" -}}
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }} {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
<main itemprop="hasPart" itemscope="" itemtype="https://schema.org/SocialMediaPosting" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}"> <main id="main" tabindex="-1"
itemprop="hasPart" itemscope="" itemtype="https://schema.org/SocialMediaPosting" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">
<link itemprop="isPartOf" href="{{ .Site.Params.CanonicalBaseURL }}/" /> <link itemprop="isPartOf" href="{{ .Site.Params.CanonicalBaseURL }}/" />
{{ partial "full-article.html" . }} {{ partial "full-article.html" . }}
{{ partial "webmentions.html" . }} {{ partial "webmentions.html" . }}

View file

@ -1,4 +1,5 @@
<header> <header>
<a href="#main">Skip to content</a>
<nav aria-label="Global"> <nav aria-label="Global">
<ul> <ul>
{{- $currentPage := . -}} {{- $currentPage := . -}}

View file

@ -1,7 +1,8 @@
{{- define "main" -}} {{- define "main" -}}
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }} {{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
{{- .Scratch.Set "codeIndex" 1 -}} {{- .Scratch.Set "codeIndex" 1 -}}
<main itemprop="mainEntity" itemscope="" itemtype="https://schema.org/BlogPosting{{ with .Params.articleType }} https://schema.org/{{ . }}{{ end }}" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}"> <main id="main" tabindex="-1"
itemprop="mainEntity" itemscope="" itemtype="https://schema.org/BlogPosting{{ with .Params.articleType }} https://schema.org/{{ . }}{{ end }}" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">
<link itemprop="isPartOf" href="{{ .Site.Params.CanonicalBaseURL }}/" /> <link itemprop="isPartOf" href="{{ .Site.Params.CanonicalBaseURL }}/" />
{{ partial "full-article.html" . }} {{ partial "full-article.html" . }}
{{ partial "webmentions.html" . }} {{ partial "webmentions.html" . }}