diff --git a/ts/a11y/explorer/KeyExplorer.ts b/ts/a11y/explorer/KeyExplorer.ts index 9ea5ad84a..096d0f53e 100644 --- a/ts/a11y/explorer/KeyExplorer.ts +++ b/ts/a11y/explorer/KeyExplorer.ts @@ -294,7 +294,7 @@ export class SpeechExplorer extends AbstractExplorer implements KeyExplo ['>', this.nextRules.bind(this)], ['<', this.nextStyle.bind(this)], ['x', this.summary.bind(this)], - ['-', this.expand.bind(this)], + ['Enter', this.expand.bind(this)], ['d', this.depth.bind(this)], ]); @@ -327,12 +327,15 @@ export class SpeechExplorer extends AbstractExplorer implements KeyExplo * Expands or collapses the currently focused node. * * @param {HTMLElement} node The focused node. + * @return {HTMLElement} The node if action was successful. O/w null. */ - public expand(node: HTMLElement) { + public expand(node: HTMLElement): HTMLElement { const expandable = this.actionable(node); - if (expandable) { - expandable.dispatchEvent(new Event('click')); + if (!expandable) { + return null; } + expandable.dispatchEvent(new Event('click')); + return node; } /** diff --git a/ts/a11y/semantic-enrich.ts b/ts/a11y/semantic-enrich.ts index 56eb013d3..b18546ee5 100644 --- a/ts/a11y/semantic-enrich.ts +++ b/ts/a11y/semantic-enrich.ts @@ -83,7 +83,7 @@ export class enrichVisitor extends SerializedMmlVisitor { // Add maction id and make sure selection is the next attribute // attributes = ` data-maction-id="${id}" selection="${node.attributes.get('selection')}"` - + attributes.replace(/ selection="\d+"/, ''); + + attributes.replace(/ selection="\d+"/, '').replace(/ data-maction-id="\d+"/, ''); } return space + '' + (children.match(/\S/) ? nl + children + endspace : '')