Skip to content

Commit a8ff2c0

Browse files
authored
Merge pull request #242 from wpaccessibility/236-tabindex
236 Add tabindex=0 to the direct parent of a codeblock and a table
2 parents cd0beb7 + f35f54e commit a8ff2c0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

assets/js/wp-a11y-docs.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -549,22 +549,23 @@
549549
});
550550

551551
/**
552-
* Makes code blocks focusable for keyboard navigation.
552+
* Makes scrollable containers focusable for keyboard navigation.
553553
*
554554
* Applies to:
555-
* - Rouge highlighter blocks
555+
* - Code blocks
556+
* - Tables
556557
* - AsciiDoc listingblocks
557558
* - Generic code `<figure>` blocks
558559
*
559560
* @function
560561
*/
561562
jtd.onReady(function() {
562-
var codeBlocks = document.querySelectorAll(
563-
'div.highlighter-rouge, div.listingblock > div.content, figure.highlight'
563+
let scrollBlocks = document.querySelectorAll(
564+
'div.highlighter-rouge > div.highlight, div.listingblock > div.content, figure.highlight, div.table-wrapper'
564565
);
565566

566-
codeBlocks.forEach(codeBlock => {
567-
codeBlock.tabIndex = 0;
567+
scrollBlocks.forEach(scrollBlock => {
568+
scrollBlock.tabIndex = 0;
568569
});
569570
});
570571

0 commit comments

Comments
 (0)