-
-
Notifications
You must be signed in to change notification settings - Fork 23
Page Anchor links do not have a discernable name #21
Copy link
Copy link
Open
Description
This markup causes a "links do not have a discernable name" error:
<h3 id="toc_introducing-ember-objects" class="anchorable-toc">
Introducing: Ember Objects
<a class="toc-anchor" href="#toc_introducing-ember-objects"></a>
</h3>This fix below works to put the text inside a link, but shipping it requires changes to styling. Since the headers become proper links, they need work to make them look like normal headers again.
In guides-article.js:
for (var element of allHeaders) {
if (element.id) {
element.className = 'anchorable-toc'
let link = document.createElement('a');
link.className = 'toc-anchor';
link.href = `#${element.id}`;
link.innerText = element.textContent;
element.innerText = '';
element.appendChild(link, element.firstElementChild);
}
}Results in
<h2 id="some-text" class="anchorable-toc"><a class="toc-anchor" href="#sometext">Some Text</a></h2>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
