Skip to content

Commit

Permalink
Add a skip to content link
Browse files Browse the repository at this point in the history
This makes the theme that tiny bit more accessible.
  • Loading branch information
pradyunsg committed Jan 30, 2024
1 parent c97ed23 commit 9450148
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/furo/assets/styles/_scaffold.sass
Expand Up @@ -44,6 +44,22 @@ body
color: var(--color-foreground-primary)
background: var(--color-background-primary)

.skip-to-content
position: fixed
padding: 1rem
border-radius: 1rem
left: 0.25rem
top: 0.25rem
z-index: 40
background: var(--color-background-primary)
color: var(--color-foreground-primary)

transform: translateY(-200%)
transition: transform 300ms ease-in-out

&:focus-within
transform: translateY(0%)

article
color: var(--color-content-foreground)
background: var(--color-content-background)
Expand Down
8 changes: 7 additions & 1 deletion src/furo/theme/furo/page.html
Expand Up @@ -13,6 +13,12 @@
<div class="visually-hidden">Hide table of contents sidebar</div>
</label>

<a class="skip-to-content muted-link" href="#furo-main-content">
{%- trans -%}
Skip to content
{%- endtrans -%}
</a>

{% if theme_announcement -%}
<div class="announcement">
<aside class="announcement-content">
Expand Down Expand Up @@ -87,7 +93,7 @@
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
</label>
</div>
<article role="main">
<article role="main" id="furo-main-content">
{% block content %}{{ body }}{% endblock %}
</article>
</div>
Expand Down

0 comments on commit 9450148

Please sign in to comment.