From d62e3a67328383bca27beddb08555d4ce1b22229 Mon Sep 17 00:00:00 2001 From: zorkow Date: Fri, 9 Feb 2024 17:42:42 +0100 Subject: [PATCH 1/4] Avoids honking during collapse action. --- ts/a11y/explorer/KeyExplorer.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ts/a11y/explorer/KeyExplorer.ts b/ts/a11y/explorer/KeyExplorer.ts index 9ea5ad84a..672ebcc97 100644 --- a/ts/a11y/explorer/KeyExplorer.ts +++ b/ts/a11y/explorer/KeyExplorer.ts @@ -330,9 +330,11 @@ export class SpeechExplorer extends AbstractExplorer implements KeyExplo */ public expand(node: HTMLElement) { const expandable = this.actionable(node); - if (expandable) { - expandable.dispatchEvent(new Event('click')); + if (!expandable) { + return null; } + expandable.dispatchEvent(new Event('click')); + return node; } /** From 30f036f968765f8804520ca5079cc57ff13f5bb6 Mon Sep 17 00:00:00 2001 From: zorkow Date: Sat, 10 Feb 2024 23:38:42 +0100 Subject: [PATCH 2/4] Removes duplicate data-maction-id that leads to XML parsing error --- ts/a11y/semantic-enrich.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 : '') From ad0ecced33e14bb8145af6bff15db973c775c873 Mon Sep 17 00:00:00 2001 From: zorkow Date: Sat, 10 Feb 2024 23:47:25 +0100 Subject: [PATCH 3/4] Changes expanse key to Enter. --- ts/a11y/explorer/KeyExplorer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/a11y/explorer/KeyExplorer.ts b/ts/a11y/explorer/KeyExplorer.ts index 672ebcc97..d6430522d 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)], ]); From 89eddf6b1e5ead776f1309ce26815b2be7bd85be Mon Sep 17 00:00:00 2001 From: zorkow Date: Sat, 10 Feb 2024 23:55:21 +0100 Subject: [PATCH 4/4] Fixes type and commenting. --- ts/a11y/explorer/KeyExplorer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/a11y/explorer/KeyExplorer.ts b/ts/a11y/explorer/KeyExplorer.ts index d6430522d..096d0f53e 100644 --- a/ts/a11y/explorer/KeyExplorer.ts +++ b/ts/a11y/explorer/KeyExplorer.ts @@ -327,8 +327,9 @@ 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) { return null;