Skip to content

Commit 2d926c8

Browse files
committed
updated logic for link generation
1 parent 90d3645 commit 2d926c8

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

js/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import autocomplete from './algolia'
2323
import mapTable from './map-table'
2424
import expando from './expando'
2525
import codeCopy from './code-copy'
26-
import skipNav from './skip-nav'
2726

2827
feedback()
2928
accordion()
@@ -48,5 +47,4 @@ searchBar()
4847
glightbox()
4948
mapTable()
5049
expando()
51-
codeCopy()
52-
skipNav()
50+
codeCopy()

js/skip-nav/skip-nav.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
const button =
2-
document.createElement ('skiplink');
1+
const button = document.createElement ('skiplink');
32
button.textContent = 'Skip to main content';
43

5-
button.addEventListener ('focus-visible', => {
6-
button.style.display = 'inline-block';
7-
});
4+
button.addEventListener ('focus', (keypress) => {
5+
button.style.display = 'inline-block';
6+
});
87

9-
button.addEventListener ('focus-invisible', => {
8+
button.addEventListener ('blur', (keypress) => {
109
button.style.display = 'none';
11-
});
10+
});
1211

12+
document.body.appendChild(button)

src/_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<link rel="stylesheet" href="{{ '/assets/algolia.css' | relative_url }}">
8181
</head>
8282
<body>
83-
<a href="#breadcrumbs__link" class="skiplink">Skip to main content</a>
83+
<a href="#{{ page.title | downcase | split:" " | join:"-" }}" class="skiplink">Skip to main content</a>
8484
<div id="consent-manager"></div>
8585
{{ content }}
8686
<a class="back-scrolling" data-back-scrolling data-active-class="back-scrolling--active">

0 commit comments

Comments
 (0)