Skip to content

Commit 8970592

Browse files
committed
a11y tweaks
1 parent 5b477a0 commit 8970592

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/site-kit/src/lib/docs/DocsContents.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@
7272
}
7373
7474
li {
75+
position: relative;
7576
display: block;
7677
margin: 0;
7778
margin-bottom: 4rem;
79+
padding-right: 0.5rem; /* leave space for focus ring */
7880
}
7981
8082
li:last-child {
@@ -125,14 +127,14 @@
125127
overflow-y: auto;
126128
}
127129
128-
:global(.scrollbars-invisible) [aria-current='page']::after {
130+
:global(.scrollbars-invisible) li:has(> [aria-current='page'])::after {
129131
--size: 1.8rem;
130132
content: '';
131133
position: absolute;
132134
width: var(--size);
133135
height: var(--size);
134136
top: calc(1.4rem - var(--size) * 0.5);
135-
right: calc(-0.5 * var(--size));
137+
right: calc(-0.5rem - 0.5 * var(--size));
136138
background-color: var(--sk-bg-1);
137139
z-index: 2;
138140
position: absolute;

packages/site-kit/src/lib/markdown/renderer.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,15 @@ async function syntax_highlight({
857857
html = replace_blank_lines(highlighted);
858858
}
859859

860-
// munge shiki output: put whitespace outside `<span>` elements, so that
861-
// highlight delimiters fall outside tokens
862-
html = html.replace(/(<span[^>]+?>)(\s+)/g, '$2$1').replace(/(\s+)(<\/span>)/g, '$2$1');
860+
// munge shiki output
861+
html = html
862+
// put whitespace outside `<span>` elements, so that
863+
// highlight delimiters fall outside tokens
864+
.replace(/(<span[^>]+?>)(\s+)/g, '$2$1')
865+
.replace(/(\s+)(<\/span>)/g, '$2$1')
866+
867+
// remove tabindex
868+
.replace(' tabindex="0"', '');
863869

864870
html = html
865871
.replace(/ {13}([^ ][^]+?) {13}/g, (_, content) => {

0 commit comments

Comments
 (0)