Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions ts/a11y/explorer/KeyExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export class SpeechExplorer extends AbstractExplorer<string> 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)],
]);

Expand Down Expand Up @@ -327,12 +327,15 @@ export class SpeechExplorer extends AbstractExplorer<string> 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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion ts/a11y/semantic-enrich.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class enrichVisitor<N, T, D> 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 + '<maction' + attributes + '>'
+ (children.match(/\S/) ? nl + children + endspace : '')
Expand Down