Skip to content

Commit

Permalink
Remove markdownItAnchor (#1048)
Browse files Browse the repository at this point in the history
Rationale: markdownItAnchor adds links with the hash symbol (#) to the headings of any page but those links are marked `aria-hidden="true"` which produces empty links that can be reached by keyboard. It is confusing for users of assistive technology. 

In an attempt to fix it one could add `tabindex="-1"` to those links, making them unavailable for keyboard users. But that would also be an issue.

I think the optimal solution is having a switch to turn those links on and adding an `aria-label` that says “Direct link to [this section] of the page”, with [this section] replaced by the name of the section.

Until a better solution exists I would remove the functionality as a whole.
  • Loading branch information
yatil committed Aug 6, 2020
1 parent 764da4d commit 7cb227b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,13 @@ module.exports = function (eleventyConfig) {

/* Markdown Plugins */
let markdownIt = require("markdown-it");
let markdownItAnchor = require("markdown-it-anchor");
let options = {
html: true,
breaks: true,
linkify: true
};
let opts = {
permalink: true,
permalinkClass: "direct-link",
permalinkSymbol: "#"
};

eleventyConfig.setLibrary("md", markdownIt(options)
.use(markdownItAnchor, opts)
);
eleventyConfig.setLibrary("md", markdownIt(options));

eleventyConfig.addTransform("htmlmin", function (content, outputPath) {
if (
Expand Down

0 comments on commit 7cb227b

Please sign in to comment.