Skip to content

Commit 21f873f

Browse files
authored
Merge pull request #684 from mathjax/a11y_refocus_on_mouse_collapse
A11y refocus on mouse collapse
2 parents 8e0d110 + 1e91a2d commit 21f873f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ts/a11y/explorer/KeyExplorer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ export abstract class AbstractKeyExplorer<T> extends AbstractExplorer<T> impleme
116116
public Update(force: boolean = false) {
117117
if (!this.active && !force) return;
118118
this.highlighter.unhighlight();
119-
this.highlighter.highlight(this.walker.getFocus(true).getNodes());
119+
let nodes = this.walker.getFocus(true).getNodes();
120+
if (!nodes.length) {
121+
this.walker.refocus();
122+
nodes = this.walker.getFocus().getNodes();
123+
}
124+
this.highlighter.highlight(nodes);
120125
}
121126

122127
/**

ts/a11y/sre_browser.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ declare namespace sre {
3030
deactivate(): void;
3131
speech(): string;
3232
move(key: number): boolean;
33+
refocus(): void;
3334
getFocus(update?: boolean): Focus;
3435
update(options: {[key: string]: string}): void;
3536
}

0 commit comments

Comments
 (0)