Skip to content

Commit f12dcb2

Browse files
committed
Have the explorer look harder for the associated anchor node. (mathjax/MathJax#3398)
1 parent e7ee4e0 commit f12dcb2

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
@@ -1303,9 +1303,14 @@ export class SpeechExplorer
13031303
?.getAttribute('data-semantic-postfix')
13041304
?.match(/(^| )link($| )/);
13051305
if (focus) {
1306-
node.parentNode.dispatchEvent(new MouseEvent('click'));
1307-
setTimeout(() => this.FocusOut(null), 50);
1308-
return true;
1306+
while (node && node !== this.node) {
1307+
if (node instanceof HTMLAnchorElement) {
1308+
node.dispatchEvent(new MouseEvent('click'));
1309+
setTimeout(() => this.FocusOut(null), 50);
1310+
return true;
1311+
}
1312+
node = node.parentNode as HTMLElement;
1313+
}
13091314
}
13101315
return false;
13111316
}

0 commit comments

Comments
 (0)