Skip to content

Commit

Permalink
Merge pull request #11 from merkle-open/fix/accessibility
Browse files Browse the repository at this point in the history
fix: improve accessibility for toc block anchor links
  • Loading branch information
bchristiani authored Mar 28, 2024
2 parents 624975a + 19ff85b commit e326ad6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
15 changes: 6 additions & 9 deletions blocks/toc/toc.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.toc > div {
display: flex;
flex-direction: column;
font-size: var(--body-font-size-xs);
font-size: var(--body-font-size-s);
color: var(--toc-color);
}

Expand All @@ -20,7 +20,7 @@
}

.toc .toc-title h2 {
font-size: var(--body-font-size-s);
font-size: var(--body-font-size-m);
margin-bottom: 30px;
}

Expand All @@ -30,15 +30,12 @@
padding-bottom: 1em;
}

.toc .toc-item p strong a.hash-link {
background-color:transparent;
color: var(--highlight-color);
}

.toc .toc-item p strong a.hash-link:hover {
.toc .toc-item p a.hash-link {
background-color:transparent;
color: var(--highlight-color);
color: var(--link-color);
text-decoration: underline;
text-decoration-color: var(--highlight-color);
text-decoration-thickness: 2px;
}

.toc .toc-item::before {
Expand Down
1 change: 1 addition & 0 deletions blocks/toc/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default function decorate(block) {
col.querySelectorAll('a').forEach((a) => {
if (a.getAttribute('href').charAt(0) === '#') {
a.classList.add('hash-link');
a.classList.remove('button');
}
});
});
Expand Down

0 comments on commit e326ad6

Please sign in to comment.