only focus code blocks if overflow

This commit is contained in:
Heydon Pickering 2017-08-18 10:33:09 +01:00
parent 0c2b484787
commit ff8f5374b2
3 changed files with 7 additions and 3 deletions

View File

@ -117,8 +117,10 @@
Array.prototype.forEach.call(codeBlocks, function (block) {
if (block.querySelector('code')) {
block.setAttribute('role', 'region');
block.setAttribute('tabindex', '0');
block.setAttribute('aria-label', 'code sample');
if (block.scrollWidth > block.clientWidth) {
block.setAttribute('tabindex', '0');
}
}
});
}());

File diff suppressed because one or more lines are too long

View File

@ -117,8 +117,10 @@
Array.prototype.forEach.call(codeBlocks, function (block) {
if (block.querySelector('code')) {
block.setAttribute('role', 'region');
block.setAttribute('tabindex', '0');
block.setAttribute('aria-label', 'code sample');
if (block.scrollWidth > block.clientWidth) {
block.setAttribute('tabindex', '0');
}
}
});
}());