Skip to content

Commit 71fec6e

Browse files
authored
Merge pull request #1318 from mathjax/issue3398
Have the explorer look harder for the associated anchor node. (mathjax/MathJax#3398)
2 parents c7e5dbf + f12dcb2 commit 71fec6e

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

ts/a11y/explorer/KeyExplorer.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,9 +1636,14 @@ export class SpeechExplorer
16361636
?.getAttribute('data-semantic-postfix')
16371637
?.match(/(^| )link($| )/);
16381638
if (focus) {
1639-
node.parentNode.dispatchEvent(new MouseEvent('click'));
1640-
setTimeout(() => this.FocusOut(null), 50);
1641-
return true;
1639+
while (node && node !== this.node) {
1640+
if (node instanceof HTMLAnchorElement) {
1641+
node.dispatchEvent(new MouseEvent('click'));
1642+
setTimeout(() => this.FocusOut(null), 50);
1643+
return true;
1644+
}
1645+
node = node.parentNode as HTMLElement;
1646+
}
16421647
}
16431648
return false;
16441649
}

0 commit comments

Comments
 (0)