Skip to content

Commit

Permalink
makes pre code blocks accessible via keyboard so they can be scrolled
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimeiniesta committed Mar 17, 2020
1 parent d774f84 commit d2e1d90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions docs/js/extra.js
@@ -0,0 +1,11 @@
// Makes code blocks accessible via keyboard,
// so they can be scrolled without a mouse.
//
// More info:
// https://dequeuniversity.com/rules/axe/3.5/scrollable-region-focusable
// https://webaim.org/techniques/keyboard/tabindex

var codeblocks = document.querySelectorAll('pre code');
for (var i=0; i < codeblocks.length; i++) {
codeblocks[i].setAttribute("tabindex", "0");
}
4 changes: 2 additions & 2 deletions mkdocs.yml
Expand Up @@ -5,8 +5,6 @@ nav:
theme:
name: material
language: en
features:
- instant
logo: img/rocket-icon-300x300.png
extra:
social:
Expand All @@ -28,3 +26,5 @@ markdown_extensions:
extra_css:
- css/extra.css
- css/codehilite/borland.css
extra_javascript:
- js/extra.js

0 comments on commit d2e1d90

Please sign in to comment.