feat: add skip-to-content link to improve accessability

This commit is contained in:
Robert Kaussow 2025-03-01 22:10:57 +01:00
parent 3d695d85a0
commit ad5afb0f7d
No known key found for this signature in database
GPG Key ID: 4E692A2EAECC03C0
9 changed files with 32 additions and 4 deletions

View File

@ -22,6 +22,10 @@
</head>
<body itemscope itemtype="https://schema.org/WebPage">
<div class="w-full flex justify-center">
<a href="#main-content" id="gdoc-to-main" class="gdoc-markdown__link">Skip to main content</a>
</div>
{{ partial "svg-icon-symbols" . }}

View File

@ -4,6 +4,7 @@
<article
class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.geekdocAlign | lower) }}"
id="main-content" tabindex="-1"
>
<h1>{{ partial "utils/title" . }}</h1>
{{ partial "utils/content" . }}

View File

@ -4,6 +4,7 @@
<article
class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.geekdocAlign | lower) }}"
id="main-content" tabindex="-1"
>
<h1>{{ partial "utils/title" . }}</h1>
{{ partial "page-metadata" . }}

View File

@ -1,6 +1,6 @@
{{ define "main" }}
{{ range .Paginator.Pages }}
<article class="gdoc-post">
<article class="gdoc-post" id="main-content" tabindex="-1">
<header class="gdoc-post__header">
<h1 class="gdoc-post__title">
<a href="{{ .RelPermalink }}">{{ partial "utils/title" . }}</a>

View File

@ -1,6 +1,6 @@
{{ define "main" }}
{{ range .Paginator.Pages.ByTitle }}
<article class="gdoc-post">
<article class="gdoc-post" id="main-content" tabindex="-1">
<header class="gdoc-post__header">
<h1 class="gdoc-post__title">
<a href="{{ .RelPermalink }}">{{ partial "utils/title" . }}</a>

View File

@ -1,6 +1,6 @@
{{ define "main" }}
{{ range .Paginator.Pages }}
<article class="gdoc-markdown gdoc-post">
<article class="gdoc-markdown gdoc-post" id="main-content" tabindex="-1">
<header class="gdoc-post__header">
<h1 class="gdoc-post__title">
<a href="{{ .RelPermalink }}">{{ partial "utils/title" . }}</a>

View File

@ -1,5 +1,5 @@
{{ define "main" }}
<article class="gdoc-post">
<article class="gdoc-post" id="main-content" tabindex="-1">
<header class="gdoc-post__header">
<h1 class="gdoc-post__title">{{ partial "utils/title" . }}</h1>
<div class="flex flex-wrap align-center gdoc-post__meta gdoc-post__meta--head">

View File

@ -105,6 +105,24 @@ body {
* {
box-sizing: inherit;
}
#gdoc-to-main {
position: absolute;
margin: defaults.$padding-8 0;
padding: defaults.$padding-8;
display: inline-block;
background-color: var(--accent-color-lite);
border-radius: defaults.$border-radius;
border: defaults.$border-1 solid var(--accent-color);
transform: translateY(0);
transition: transform 250ms ease-in;
&:not(:focus) {
transform: translateY(-#{defaults.$padding-64});
}
}
}
h1,

View File

@ -101,3 +101,7 @@
display: inline-block;
min-width: 4rem;
}
.w-full {
width: 100%;
}