Skip to content

Commit 51d8985

Browse files
Add tabindex to footnotes
Adding a tabindex to the footnotes makes the footnotes focusable, showing a blue bounding box around the footnote that's linked to in most browsers.
1 parent 125b7bc commit 51d8985

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

ox-html-markdown-style-footnotes.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
(pcase definition
4040
(`(,n ,_ ,def)
4141
(format
42-
"<li id=\"fn.%d\" class=\"footdef\" role=\"doc-footnote\">%s %s</li>\n"
42+
"<li id=\"fn.%d\" class=\"footdef\" role=\"doc-footnote\" tabindex=\"-1\">%s %s</li>\n"
4343
n
4444
(org-trim (org-export-data def info))
4545
(format "<a href=\"#fnr.%d\" role=\"doc-backlink\">↩&#65038;</a>" n)))))

ox-html-markdown-style-footnotes.org

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ It also uses a backlink with an arrow, which resembles the Markdown tradition:
8989
<h2 class="footnotes">Footnotes: </h2>
9090
<div id="text-footnotes">
9191
<ol>
92-
<li id="fn.1" class="footdef" role="doc-footnote"><p class="footpara">
92+
<li id="fn.1" class="footdef" role="doc-footnote" tabindex="-1"><p class="footpara">
9393
A footnote.
9494
</p>
9595

@@ -236,7 +236,7 @@ The updated copy is defined as ~org-html-markdown-style-footnotes--section~:
236236
(pcase definition
237237
(`(,n ,_ ,def)
238238
(format
239-
"<li id=\"fn.%d\" class=\"footdef\" role=\"doc-footnote\">%s %s</li>\n"
239+
"<li id=\"fn.%d\" class=\"footdef\" role=\"doc-footnote\" tabindex=\"-1\">%s %s</li>\n"
240240
n
241241
(org-trim (org-export-data def info))
242242
(format "<a href=\"#fnr.%d\" role=\"doc-backlink\">↩&#65038;</a>" n)))))

test.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
(let ((org-html-markdown-style-footnotes t))
88
(org-html-export-as-html))
99
(should (string-match-p
10-
"<ol>\n<li id=\"fn.1\" class=\"footdef\" role=\"doc-footnote\"><p class=\"footpara\">\nA footnote.\n</p>\n\n<p class=\"footpara\">\nWith a second paragraph.\n</p> <a href=\"#fnr.1\" role=\"doc-backlink\">↩&#65038;</a></li>\n</ol>"
10+
"<ol>\n<li id=\"fn.1\" class=\"footdef\" role=\"doc-footnote\" tabindex=\"-1\"><p class=\"footpara\">\nA footnote.\n</p>\n\n<p class=\"footpara\">\nWith a second paragraph.\n</p> <a href=\"#fnr.1\" role=\"doc-backlink\">↩&#65038;</a></li>\n</ol>"
1111
(with-current-buffer "*Org HTML Export*" (buffer-string))))
1212
(org-html-markdown-style-footnotes-remove))
1313

test/fixtures/footnote-2.html

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/footnote.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)