Skip to content

Add skip to main content link #616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/sphinx_book_theme/assets/styles/components/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,18 @@ div.header-article-main {
display: none;
}
}

.skip-link {
display: block;
left: -999px;
position: absolute;
top: -999px;

&:focus {
left: 0;
padding: 0.2rem 0.3rem;
position: relative;
top: 0;
z-index: 999999;
}
}
2 changes: 2 additions & 0 deletions src/sphinx_book_theme/theme/sphinx_book_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<label class="overlay overlay-pagetoc" for="__page-toc">
<div class="visually-hidden">Toggle in-page Table of Contents</div>
</label>
<!-- Skip to main content -->
<a href="#main-content" class="skip-link">Jump to main content</a>
<!-- Headers at the top -->
<div class="announcement header-item noprint">
{%- include "sections/announcement.html" -%}
Expand Down