@@ -1518,6 +1518,14 @@ document.addEventListener("DOMContentLoaded", function () {
15181518 enhanceGitHubAlerts ( markdownPreview ) ;
15191519
15201520 processEmojis ( markdownPreview ) ;
1521+
1522+ // Add accessible dynamic labels to task list checkboxes matching their parent text
1523+ markdownPreview . querySelectorAll ( 'input[type="checkbox"]' ) . forEach ( function ( input ) {
1524+ if ( ! input . hasAttribute ( 'aria-label' ) ) {
1525+ const parentText = input . parentElement ? input . parentElement . textContent . trim ( ) : '' ;
1526+ input . setAttribute ( 'aria-label' , parentText || 'Task item' ) ;
1527+ }
1528+ } ) ;
15211529
15221530 // PERF-002: Lazy-load mermaid only when diagrams are present
15231531 try {
@@ -1559,7 +1567,11 @@ document.addEventListener("DOMContentLoaded", function () {
15591567 if ( hasMath ) {
15601568 if ( window . MathJax ) {
15611569 try {
1562- MathJax . typesetPromise ( [ markdownPreview ] ) . catch ( ( err ) => {
1570+ MathJax . typesetPromise ( [ markdownPreview ] ) . then ( function ( ) {
1571+ markdownPreview . querySelectorAll ( 'mjx-container[tabindex="0"]' ) . forEach ( function ( mjx ) {
1572+ mjx . removeAttribute ( 'tabindex' ) ;
1573+ } ) ;
1574+ } ) . catch ( function ( err ) {
15631575 console . warn ( 'MathJax typesetting failed:' , err ) ;
15641576 } ) ;
15651577 } catch ( e ) {
@@ -1578,7 +1590,11 @@ document.addEventListener("DOMContentLoaded", function () {
15781590 } ;
15791591 loadScript ( CDN . mathjax ) . then ( function ( ) {
15801592 try {
1581- MathJax . typesetPromise ( [ markdownPreview ] ) . catch ( function ( err ) {
1593+ MathJax . typesetPromise ( [ markdownPreview ] ) . then ( function ( ) {
1594+ markdownPreview . querySelectorAll ( 'mjx-container[tabindex="0"]' ) . forEach ( function ( mjx ) {
1595+ mjx . removeAttribute ( 'tabindex' ) ;
1596+ } ) ;
1597+ } ) . catch ( function ( err ) {
15821598 console . warn ( 'MathJax typesetting failed:' , err ) ;
15831599 } ) ;
15841600 } catch ( e ) {
0 commit comments