Skip to content

Commit 44b3601

Browse files
authored
Merge pull request #1054 from mathjax/feature/better_honking
Feature/better honking
2 parents eccb8a0 + 89eddf6 commit 44b3601

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ts/a11y/explorer/KeyExplorer.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export class SpeechExplorer extends AbstractExplorer<string> implements KeyExplo
294294
['>', this.nextRules.bind(this)],
295295
['<', this.nextStyle.bind(this)],
296296
['x', this.summary.bind(this)],
297-
['-', this.expand.bind(this)],
297+
['Enter', this.expand.bind(this)],
298298
['d', this.depth.bind(this)],
299299
]);
300300

@@ -327,12 +327,15 @@ export class SpeechExplorer extends AbstractExplorer<string> implements KeyExplo
327327
* Expands or collapses the currently focused node.
328328
*
329329
* @param {HTMLElement} node The focused node.
330+
* @return {HTMLElement} The node if action was successful. O/w null.
330331
*/
331-
public expand(node: HTMLElement) {
332+
public expand(node: HTMLElement): HTMLElement {
332333
const expandable = this.actionable(node);
333-
if (expandable) {
334-
expandable.dispatchEvent(new Event('click'));
334+
if (!expandable) {
335+
return null;
335336
}
337+
expandable.dispatchEvent(new Event('click'));
338+
return node;
336339
}
337340

338341
/**

ts/a11y/semantic-enrich.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class enrichVisitor<N, T, D> extends SerializedMmlVisitor {
8383
// Add maction id and make sure selection is the next attribute
8484
//
8585
attributes = ` data-maction-id="${id}" selection="${node.attributes.get('selection')}"`
86-
+ attributes.replace(/ selection="\d+"/, '');
86+
+ attributes.replace(/ selection="\d+"/, '').replace(/ data-maction-id="\d+"/, '');
8787
}
8888
return space + '<maction' + attributes + '>'
8989
+ (children.match(/\S/) ? nl + children + endspace : '')

0 commit comments

Comments
 (0)