Skip to content

Commit 4c81e1a

Browse files
committed
Reorder test for tabbing versus maction, and fixes for prettier
1 parent 7283d8f commit 4c81e1a

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

ts/a11y/explorer/KeyExplorer.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -815,17 +815,19 @@ export class SpeechExplorer
815815
if (this.triggerLinkKeyboard(event)) {
816816
this.Stop();
817817
} else {
818-
const tabs = this.getInternalTabs(this.current);
818+
const expandable = this.actionable(this.current);
819+
if (expandable) {
820+
this.refocus = expandable;
821+
expandable.dispatchEvent(new Event('click'));
822+
return;
823+
}
824+
const tabs = this.getInternalTabs(this.current).filter(
825+
(node) => !node.getAttribute('data-mjx-href')
826+
);
819827
if (tabs.length) {
820828
tabs[0].focus();
821829
return;
822830
}
823-
const expandable = this.actionable(this.current);
824-
if (!expandable) {
825-
return false;
826-
}
827-
this.refocus = expandable;
828-
expandable.dispatchEvent(new Event('click'));
829831
}
830832
} else {
831833
this.Start();
@@ -1511,9 +1513,11 @@ export class SpeechExplorer
15111513
* @returns {HTMLElement[]} The list of focusable element within the given one
15121514
*/
15131515
protected getInternalTabs(node: HTMLElement): HTMLElement[] {
1514-
return Array.from(node.querySelectorAll(
1515-
'button, [data-mjx-href], input, select, textarea, [tabindex]:not([tabindex="-1"],mjx-speech)'
1516-
));
1516+
return Array.from(
1517+
node.querySelectorAll(
1518+
'button, [data-mjx-href], input, select, textarea, [tabindex]:not([tabindex="-1"],mjx-speech)'
1519+
)
1520+
);
15171521
}
15181522

15191523
/**

0 commit comments

Comments
 (0)