Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/.vuepress/theme/components/DocSetPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
}

&.active {
@apply text-blue text-lg;
@apply text-lg;
color: var(--sidebar-active-link-color);

.home-icon {
@apply inline-block;
Expand All @@ -116,7 +117,8 @@
}

.home-title {
@apply relative pl-0 text-blue;
@apply relative pl-0;
color: var(--sidebar-active-link-color);
left: -2px;
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/theme/components/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<main class="page">
<slot name="top" />

<Content id="content" class="theme-default-content" />
<Content id="content" class="theme-default-content" tabindex="-1" />

<PageNav v-bind="{ sidebarItems }" />

Expand Down
22 changes: 22 additions & 0 deletions docs/.vuepress/theme/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
@touchstart="onTouchStart"
@touchend="onTouchEnd"
>
<span ref="backToTop" tabindex="-1" />
<ul class="skip-links">
<li>
<a @click="handleSkipLink" href="#content" class="skip-link">Skip to main content</a>
</li>
</ul>
<div id="nprogress-container"></div>
<div class="sidebar-mask" @click="toggleSidebar(false)" />
<LeftBar
Expand Down Expand Up @@ -179,6 +185,12 @@ export default {
Hamburger,
},

watch: {
'$route.path'() {
this.$refs.backToTop.focus()
}
},

data: () => ({
isSidebarOpen: false,
isSidebarTransitioning: false,
Expand Down Expand Up @@ -358,6 +370,16 @@ export default {
this.$emit("toggle-sidebar", this.isSidebarOpen);
},

handleSkipLink(event) {
event.preventDefault();
const {target} = event;
const skipLinkTarget = this.$el.querySelector(target.getAttribute('href'));

if (skipLinkTarget) {
skipLinkTarget.focus({focusVisible: false});
}
},

handleWidthChange() {
if (typeof document === "undefined") {
return;
Expand Down
32 changes: 32 additions & 0 deletions docs/.vuepress/theme/styles/base.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@
--custom-block-bg-color: theme("colors.softer");
--custom-block-border-color: theme("colors.soft");
--craft-red: #e5422b;
--white: theme("colors.white");
--black: theme("colors.black");
--custom-focus-outline: 2px solid var(--link-color-default);

/* Custom button */
--button-background-color: theme("colors.blue.default");
--button-text-color: var(--white);
--button-border-color: theme("colors.blue.darker");
--button-border-radius: 4px;

/* Code */
--code-color-default: #476582;
--code-color-gold: #8A6700;
Expand Down Expand Up @@ -69,6 +77,30 @@ a {
color: var(--link-color-default);
}

.skip-links {
list-style: none;
}

.skip-link {
white-space: nowrap;
top: .5em;
position: fixed;
left: -1000px;
opacity: 0;
background-color: var(--button-background-color);
color: var(--button-text-color);
font-weight: 500;
padding: .75em 1.5em;
border: 1px solid var(--button-border-color);
border-radius: var(--button-border-radius);
}

.skip-link:focus {
opacity: 1;
z-index: 100;
left: .5em;
}

img {
@apply max-w-full;
}
Expand Down
10 changes: 10 additions & 0 deletions docs/.vuepress/theme/styles/color-mode.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
--sidebar-active-link-color: var(--link-color-default);
--code-link-color: theme("colors.blue.lighter");

/* Buttons */
--button-background-color: theme("colors.gray.800");
--button-text-color: var(--white);
--button-border-color: #818EA2;

/* Code */
--code-color-default: #7F9CB8;
--code-color-gold: #BD8E00;
Expand Down Expand Up @@ -67,6 +72,11 @@
--sidebar-active-link-color: var(--link-color-default);
--code-link-color: theme("colors.blue.lighter");

/* Buttons */
--button-background-color: theme("colors.gray.800");
--button-text-color: var(--white);
--button-border-color: #818EA2;

/* Code */
--code-color-default: #7F9CB8;
--code-color-gold: #BD8E00;
Expand Down