Skip to content
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

Prevent skip links from overlapping header #30897

Merged
merged 1 commit into from Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 14 additions & 7 deletions site/assets/scss/_skippy.scss
@@ -1,13 +1,20 @@
// stylelint-disable declaration-no-important

.skippy {
position: fixed;
top: .5rem;
left: .5rem;
z-index: $zindex-fixed;
padding: .5rem;
color: $white;
background-color: $bd-purple;

&:hover {
a {
color: $white;
}

&:focus-within a {
position: static !important;
width: auto !important;
height: auto !important;
padding: $spacer / 2 !important;
margin: $spacer / 4 !important;
overflow: visible !important;
clip: auto !important;
white-space: normal !important;
}
}
12 changes: 8 additions & 4 deletions site/layouts/partials/skippy.html
@@ -1,5 +1,9 @@
<a class="skippy visually-hidden-focusable" href="#content">Skip to main content</a>
<div class="skippy overflow-hidden">
<div class="container-xl">
<a class="visually-hidden-focusable d-inline-flex p-2 m-1" href="#content">Skip to main content</a>

{{ if (eq .Page.Layout "docs") }}
<a class="skippy visually-hidden-focusable d-none d-md-block" href="#bd-docs-nav">Skip to docs navigation</a>
{{- end }}
{{ if (eq .Page.Layout "docs") }}
<a class="visually-hidden-focusable d-none d-md-inline-flex p-2 m-1" href="#bd-docs-nav">Skip to docs navigation</a>
{{- end }}
</div>
</div>