Explorar o código

only focus code blocks if overflow

Heydon Pickering %!s(int64=8) %!d(string=hai) anos
pai
achega
ff8f5374b2

+ 3 - 1
docs/js/dom-scripts.js

@@ -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');
+      }
     }
   });
 }());

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
docs/service-worker.js


+ 3 - 1
themes/infusion/static/js/dom-scripts.js

@@ -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');
+      }
     }
   });
 }());

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio