From a1ac2c7fd9447cd4b07303e7bee53d1c90218a5c Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Tue, 3 Dec 2024 23:52:59 +0800 Subject: [PATCH] Update article about footnotes with larger link target area --- .../myarticles/accessible-footnotes.md | 99 ++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/src/articles/myarticles/accessible-footnotes.md b/src/articles/myarticles/accessible-footnotes.md index e7e8f235..5ddc299a 100644 --- a/src/articles/myarticles/accessible-footnotes.md +++ b/src/articles/myarticles/accessible-footnotes.md @@ -1,6 +1,7 @@ --- articleTitle: How I (Tried to) Implement Accessible Footnotes date: 2024-08-06T00:04:00+0800 +updated: 2024-12-03T23:51:27+0800 desc: "How I implement accessible footnotes, at least to the best of my ability. Written for 32-Bit Cafe's Community Code Jam #5." categories: ["32-bit cafe", "accessibility", "html", "css", "eleventy", "markdown-it"] toc: true @@ -21,7 +22,7 @@ On [32-Bit Cafe's Discourse forum](https://discourse.32bit.cafe/), I made a [pos Plagiarism.org [defines footnotes](https://www.plagiarism.org/article/what-are-footnotes) as notes placed at the bottom of a page, and what footnotes do is to cite references or comment on a designated part of the text above it. -My use case of footnotes is citing sources of information, particularly citing the same source multiple times on the same page when information from the same source is spread across my page. As of this writing, my website pages that use footnotes include the [trivia page of my {% cite "A Summer’s End — Hong Kong 1986" %} shrine 1](https://leilukin.com/shrines/asummersend/trivia/) and the [facts page of my {% cite "Cassette Beasts" %} shrine](https://leilukin.com/shrines/cassettebeasts/facts/). You are free to look at the HTML and CSS for reference, including when you are reading this article as I am explaining how I implement the footnotes. +My use case of footnotes is citing sources of information, particularly citing the same source multiple times on the same page when information from the same source is spread across my page. As of this writing, my website pages that use footnotes include the [trivia page of my {% cite "A Summer’s End — Hong Kong 1986" %} shrine 1](/shrines/asummersend/trivia/) and the [facts page of my {% cite "Cassette Beasts" %} shrine](/shrines/cassettebeasts/facts/). You are free to look at the HTML and CSS for reference. Footnotes are used both on print and on the web. However, maintaining footnotes on the web can be tedious, especially if you want to update a web page to add or remove them, since you will need to change the number references of existing footnotes. @@ -236,4 +237,98 @@ As for citing sources, the simplest way would be naming and linking to the sourc Creating and maintaining footnotes on web pages is tricky, so I hope my article about accessible footnotes is helpful if you want to create them. -I am still not completely certain if my method is the best, although I tried to the best of my abilities, so I am interested in hearing feedback for my way of implementing accessible footnotes. \ No newline at end of file +I am still not completely certain if my method is the best, although I tried to the best of my abilities, so I am interested in hearing feedback for my way of implementing accessible footnotes. + +## Update 3 December 2024: Enlarge Link Target Area + +On 3 December 2024, [~hedy](https://home.hedy.dev/) emailed me talking about this article, offering additional tips for improving footnotes. She also recommended me to check out [Seirdy](https://seirdy.one/)'s blog as a reference for formatting footnotes. + +I found ~hedy's suggestions good, so I made further improvements to my footnotes, by enlarging the target area of links. To achieve this, I changed the reference labels and footnote backlinks by using visible longer link text instead of ARIA labels. + +Specifically, for reference labels, I now use "[Note 1]" instead of just a number like "[1]", while for footnote backlinks, I use "↩︎ Back to reference 1" instead of just a ↩︎ symbol. + +In addition, I wrap each footnote backlink in a paragraph element (`
`), to place each backlink per line to improve footnotes' readability. + +Larger link target area is even better because mobile device users would find it easier to tap on the reference links and the footnote backlinks, and sighted visitors on desktop are also benefited because they can see the purpose of these links on plain slight. + +### Updated HTML Markup + +Here is an example of how the final HTML markup would look like with larger link target area: + +```html +
This is a paragraph with the first footnote reference. [Note 1]
+ +Here is the second paragraph with the second footnote reference. [Note 2]
+ +This the third paragraph, but with a foootnote reference that points to the first footnote. [Note 1:1]
+ ++ + + + Back to reference ${id} +
+ `; + }; + + const renderRules = { + footnote_caption: ['[', '[Note '], + }; + Object.keys(renderRules).map(rule => { + let defaultRender = markdownLibrary.renderer.rules[rule]; + markdownLibrary.renderer.rules[rule] = (tokens, idx, options, env, self) => { + return defaultRender(tokens, idx, options, env, self).replace(...renderRules[rule]); + } + }); + + /* This is the part that tells 11ty to swap to our custom config */ + eleventyConfig.setLibrary("md", markdownLibrary); +} +``` \ No newline at end of file