Skip to content

Commit d66a1c5

Browse files
committed
Fix starting of explorer when speech isn't selected
1 parent 43350ae commit d66a1c5

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ts/a11y/explorer/ExplorerPool.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,15 @@ export class ExplorerPool {
211211
public attach() {
212212
this.attached = [];
213213
let keyExplorers = [];
214+
const a11y = this.document.options.a11y;
214215
for (let key of Object.keys(this.explorers)) {
215216
let explorer = this.explorers[key];
216217
if (explorer instanceof SpeechExplorer) {
217218
explorer.AddEvents();
218219
explorer.stoppable = false;
219220
keyExplorers.unshift(explorer);
220221
}
221-
if (this.document.options.a11y[key]) {
222+
if (a11y[key] || (key === 'speech' && (a11y.braille || a11y.keyMagnifier))) {
222223
explorer.Attach();
223224
this.attached.push(key);
224225
} else {

ts/a11y/explorer/KeyExplorer.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ export class SpeechExplorer extends AbstractExplorer<string> implements KeyExplo
178178
const prev = this.node.querySelector(prevNav);
179179
if (prev) {
180180
prev.removeAttribute('tabindex');
181+
this.FocusOut(null);
181182
}
182183
this.current = clicked;
183184
if (!this.triggerLinkMouse()) {
@@ -477,24 +478,25 @@ export class SpeechExplorer extends AbstractExplorer<string> implements KeyExplo
477478
// the root node by default.
478479
this.current = this.node.childNodes[0] as HTMLElement;
479480
}
481+
const options = this.document.options;
480482
let promise = Sre.sreReady();
481-
if (this.generators.update(this.document.options)) {
483+
if (this.generators.update(options)) {
482484
promise = promise.then(
483485
() => this.Speech()
484486
);
485487
};
486488
this.current.setAttribute('tabindex', '0');
487489
this.current.focus();
488490
super.Start();
489-
if (this.document.options.a11y.subtitles && this.document.options.enableSpeech) {
491+
if (options.a11y.subtitles && options.a11y.speech && options.enableSpeech) {
490492
promise.then(
491493
() => this.region.Show(this.node, this.highlighter));
492494
}
493-
if (this.document.options.a11y.viewBraille && this.document.options.enableBraille) {
495+
if (options.a11y.viewBraille && options.a11y.braille && options.enableBraille) {
494496
promise.then(
495497
() => this.brailleRegion.Show(this.node, this.highlighter));
496498
}
497-
if (this.document.options.a11y.keyMagnifier) {
499+
if (options.a11y.keyMagnifier) {
498500
this.magnifyRegion.Show(this.node, this.highlighter);
499501
}
500502
this.Update();

0 commit comments

Comments
 (0)