about summary refs log tree commit diff
path: root/kittybox-rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-01-25 05:09:52 +0300
committerVika <vika@fireburn.ru>2023-01-25 05:09:52 +0300
commit59c6f6ca069df3d877db24a0a0aebcd0dfaca5a2 (patch)
tree3fcb2c5767a1c69efa39d812069051bdcd79abc9 /kittybox-rs
parentd0a424cbb7fa8bdc941fc1def43dad5d11ea31bf (diff)
downloadkittybox-59c6f6ca069df3d877db24a0a0aebcd0dfaca5a2.tar.zst
Add a skip link to the page layout
I tried to run my website through a screen reader, and thought this
would be a nice addition.

Also it turns out my website is *mostly* accessible as it is -- yay
for semantic HTML!
Diffstat (limited to 'kittybox-rs')
-rw-r--r--kittybox-rs/templates/assets/style.css19
-rw-r--r--kittybox-rs/templates/src/templates.rs3
2 files changed, 19 insertions, 3 deletions
diff --git a/kittybox-rs/templates/assets/style.css b/kittybox-rs/templates/assets/style.css
index b46dbf8..4cd7c09 100644
--- a/kittybox-rs/templates/assets/style.css
+++ b/kittybox-rs/templates/assets/style.css
@@ -39,8 +39,8 @@ nav#headerbar {
     border-bottom: .75rem solid var(--secondary-accent);
     padding: .3rem;
     vertical-align: center;
-    position: sticky;
-    top: 0;
+    /*position: sticky;
+    top: 0;*/
 }
 nav#headerbar a#homepage {
     font-weight: bolder;
@@ -219,3 +219,18 @@ span.like-icon-label {
 ul.h-feed {
     list-style: none;
 }
+
+body > a#skip-to-content {
+    position: absolute;
+    width: 1px;
+    height: 1px;
+    margin: 0;
+    overflow: hidden;
+    clip: rect(1px, 1px, 1px, 1px);
+    background: white;
+    padding: 16px;
+}
+body > a#skip-to-content:focus {
+    width: auto; height: auto; clip: auto;
+    z-index: 999;
+}
diff --git a/kittybox-rs/templates/src/templates.rs b/kittybox-rs/templates/src/templates.rs
index ba5b684..ba52af7 100644
--- a/kittybox-rs/templates/src/templates.rs
+++ b/kittybox-rs/templates/src/templates.rs
@@ -31,6 +31,7 @@ markup::define! {
                 }*/
             }
             body {
+                a[href="#main_content", id="skip-to-content"] { "Skip to content" }
                 // TODO Somehow compress headerbar into a menu when the screen space is tight
                 nav #headerbar {
                     ul {
@@ -49,7 +50,7 @@ markup::define! {
                         }
                     }
                 }
-                main {
+                main #main_content {
                     @markup::raw(content)
                 }
                 footer {