Skip to content

Commit de21708

Browse files
author
Tony Sansone
committed
Fix ARIA errors
1 parent 779e378 commit de21708

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/_sass/site.scss

+3-2
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ main .content {
297297
margin-left: -($icon-size + $anchor-padding);
298298
padding-right: $anchor-padding;
299299
overflow: hidden;
300-
300+
301301
.octicon-link {
302302
@include transition(.1s);
303303

@@ -317,7 +317,7 @@ main .content {
317317
}
318318

319319
&:focus .octicon-link {
320-
opacity: 1
320+
opacity: 1;
321321
}
322322
}
323323

@@ -331,6 +331,7 @@ main .content {
331331
&[id] {
332332
scroll-margin: 60px;
333333
}
334+
334335
}
335336

336337
// Push # link targets clear of page header.

src/assets/js/main.js

+16
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,19 @@ function adjustToc() {
124124
$(document.body).scrollspy({ offset: 100, target: '#site-toc--side' });
125125
}
126126

127+
function adjustHeadingAnchors() {
128+
document.addEventListener('DOMContentLoaded', function() {
129+
const headingAnchors = document.querySelectorAll('a.anchor[aria-hidden]');
130+
// const headingAnchors = document.querySelectorAll('span.octicon-link');
131+
// const headingAnchors = document.querySelectorAll('h2[id]');
132+
console.log(headingAnchors)
133+
headingAnchors.forEach(element => {
134+
// element.setAttribute('aria-disabled', 'true');
135+
element.setAttribute('tabindex', '-1');
136+
});
137+
});
138+
}
139+
127140
function createGallery() {
128141
for (let i = 0; i < arguments.length; i++) {
129142
const galleryName = arguments[i];
@@ -241,4 +254,7 @@ $(function() {
241254
}
242255
});
243256

257+
244258
});
259+
260+
adjustHeadingAnchors(); // Disable ARIA for copyable anchor links

0 commit comments

Comments
 (0)