From c79aa915b7205514b83c092e1e220706e31d139c Mon Sep 17 00:00:00 2001 From: zorkow Date: Wed, 21 Aug 2019 11:58:16 +0200 Subject: [PATCH 1/2] Renaming of magnifiers and treecoloring. --- mathjax3-ts/a11y/explorer.ts | 32 ++++++++++++++++---------------- mathjax3-ts/ui/menu/Menu.ts | 12 ++++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/mathjax3-ts/a11y/explorer.ts b/mathjax3-ts/a11y/explorer.ts index 562837d73..9433b445d 100644 --- a/mathjax3-ts/a11y/explorer.ts +++ b/mathjax3-ts/a11y/explorer.ts @@ -183,11 +183,11 @@ export function ExplorerMathItemMixin>( let lastKeyExplorer = null; for (let explorer of this.attached) { if (!(explorer instanceof ke.AbstractKeyExplorer)) continue; - if (lastKeyExplorer) { - lastKeyExplorer.stoppable = false; - } + explorer.stoppable = false; lastKeyExplorer = explorer; - lastKeyExplorer.stoppable = true; + } + if (lastKeyExplorer) { + lastKeyExplorer.stoppable = true; } } @@ -245,13 +245,13 @@ export function ExplorerMathDocumentMixin + keyMagnifier: (doc: ExplorerMathDocument, node: HTMLElement, ...rest: any[]) => ke.Magnifier.create(doc, doc.explorerRegions.magnifier, node, ...rest), - mousemagnifier: (doc: ExplorerMathDocument, node: HTMLElement, ...rest: any[]) => + mouseMagnifier: (doc: ExplorerMathDocument, node: HTMLElement, ...rest: any[]) => me.ContentHoverer.create(doc, doc.explorerRegions.magnifier, node, (x: HTMLElement) => x.hasAttribute('data-semantic-type'), (x: HTMLElement) => x), @@ -409,7 +409,7 @@ let allExplorers: {[options: string]: ExplorerInit} = { (x: HTMLElement) => x.getAttribute('data-semantic-prefix')), flame: (doc: ExplorerMathDocument, node: HTMLElement, ...rest: any[]) => FlameColorer.create(doc, null, node), - treecoloring: (doc: ExplorerMathDocument, node: HTMLElement, ...rest: any[]) => + treeColoring: (doc: ExplorerMathDocument, node: HTMLElement, ...rest: any[]) => TreeColorer.create(doc, null, node, ...rest) }; @@ -462,18 +462,18 @@ export function setA11yOption(document: HTMLDOCUMENT, option: string, value: str switch (value) { case 'None': document.options.a11y.magnifier = value; - document.options.a11y.keymagnifier = false; - document.options.a11y.mousemagnifier = false; + document.options.a11y.keyMagnifier = false; + document.options.a11y.mouseMagnifier = false; break; case 'Keyboard': document.options.a11y.magnifier = value; - document.options.a11y.keymagnifier = true; - document.options.a11y.mousemagnifier = false; + document.options.a11y.keyMagnifier = true; + document.options.a11y.mouseMagnifier = false; break; case 'Mouse': document.options.a11y.magnifier = value; - document.options.a11y.keymagnifier = false; - document.options.a11y.mousemagnifier = true; + document.options.a11y.keyMagnifier = false; + document.options.a11y.mouseMagnifier = true; break; } break; diff --git a/mathjax3-ts/ui/menu/Menu.ts b/mathjax3-ts/ui/menu/Menu.ts index 6623313b2..02e26d826 100644 --- a/mathjax3-ts/ui/menu/Menu.ts +++ b/mathjax3-ts/ui/menu/Menu.ts @@ -83,7 +83,7 @@ export interface MenuSettings { speech: boolean; speechrules: string; subtitles: boolean; - treecoloring: boolean; + treeColoring: boolean; viewbraille: boolean; } @@ -119,8 +119,8 @@ export class Menu { scale: 1, autocollapse: false, collapsible: false, - inTabOrder: true - explorer: false, + inTabOrder: true, + explorer: false }, jax: { CHTML: null, @@ -409,8 +409,8 @@ export class Menu { this.setA11y({'magnification': magnification})), this.variable ('magnify', (magnify: string) => this.setA11y({'magnify': magnify})), - this.variable('treecoloring', (treecoloring: boolean) => - this.setA11y({'treecoloring': treecoloring})), + this.variable('treeColoring', (treeColoring: boolean) => + this.setA11y({'treeColoring': treeColoring})), this.variable('infoType', (infoType: boolean) => this.setA11y({'infoType': infoType})), this.variable('infoRole', (infoRole: boolean) => @@ -494,7 +494,7 @@ export class Menu { ['None'], ['Hover'], ['Flame'] ]), this.rule(), - this.checkbox('TreeColoring', 'Tree Coloring', 'treecoloring') + this.checkbox('TreeColoring', 'Tree Coloring', 'treeColoring') ]), this.submenu('Magnification', 'Magnification', [ this.radioGroup('magnification', [ From f53d28481794d063b1249820ce88d7659cf2752a Mon Sep 17 00:00:00 2001 From: zorkow Date: Wed, 21 Aug 2019 12:05:16 +0200 Subject: [PATCH 2/2] Implemented all review suggestions. --- mathjax3-ts/a11y/explorer.ts | 6 +++--- mathjax3-ts/ui/menu/Menu.ts | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mathjax3-ts/a11y/explorer.ts b/mathjax3-ts/a11y/explorer.ts index 9433b445d..7eee0c242 100644 --- a/mathjax3-ts/a11y/explorer.ts +++ b/mathjax3-ts/a11y/explorer.ts @@ -252,7 +252,7 @@ export function ExplorerMathDocumentMixin @@ -444,7 +444,7 @@ export function setA11yOptions(document: HTMLDOCUMENT, options: {[key: string]: } } // Reinit explorers - for (let item of document.math ) { + for (let item of document.math) { (item as ExplorerMathItem).attachExplorers(document as ExplorerMathDocument); } } diff --git a/mathjax3-ts/ui/menu/Menu.ts b/mathjax3-ts/ui/menu/Menu.ts index 02e26d826..42a00601e 100644 --- a/mathjax3-ts/ui/menu/Menu.ts +++ b/mathjax3-ts/ui/menu/Menu.ts @@ -81,10 +81,10 @@ export interface MenuSettings { magnification: string; magnify: string; speech: boolean; - speechrules: string; + speechRules: string; subtitles: boolean; treeColoring: boolean; - viewbraille: boolean; + viewBraille: boolean; } export type HTMLMATHITEM = MathItem; @@ -401,10 +401,10 @@ export class Menu { this.setA11y({'subtitles': subtitles})), this.variable('braille', (braille: boolean) => this.setA11y({'braille': braille})), - this.variable('viewbraille', (viewbraille: boolean) => - this.setA11y({'viewbraille': viewbraille})), - this.variable ('speechrules', (speechrules: string) => - this.setA11y({'speechrules': speechrules})), + this.variable('viewBraille', (viewBraille: boolean) => + this.setA11y({'viewBraille': viewBraille})), + this.variable ('speechRules', (speechRules: string) => + this.setA11y({'speechRules': speechRules})), this.variable ('magnification', (magnification: string) => this.setA11y({'magnification': magnification})), this.variable ('magnify', (magnify: string) => @@ -464,19 +464,19 @@ export class Menu { this.checkbox('Activate', 'Activate', 'explorer'), this.submenu('Speech', 'Speech', [ this.checkbox('Speech', 'Speech Output', 'speech'), - this.checkbox('Subtitles', 'Subtities', 'subtitles'), - this.checkbox('Braille', 'Braille', 'braille'), - this.checkbox('View Braille', 'View Braille', 'viewbraille'), + this.checkbox('Subtitles', 'Speech Subtities', 'subtitles'), + this.checkbox('Braille', 'Braille Output', 'braille'), + this.checkbox('View Braille', 'Braille Subtitles', 'viewBraille'), this.rule(), - this.submenu('Mathspeak', 'Mathspeak Rules', this.radioGroup('speechrules', [ + this.submenu('Mathspeak', 'Mathspeak Rules', this.radioGroup('speechRules', [ ['mathspeak-default', 'Verbose'], ['mathspeak-brief', 'Brief'], ['mathspeak-sbrief', 'Superbrief'] ])), - this.submenu('Clearspeak', 'Clearspeak Rules', this.radioGroup('speechrules', [ + this.submenu('Clearspeak', 'Clearspeak Rules', this.radioGroup('speechRules', [ ['clearspeak-default', 'Standard'] ])), - this.submenu('ChromeVox', 'ChromeVox Rules', this.radioGroup('speechrules', [ + this.submenu('ChromeVox', 'ChromeVox Rules', this.radioGroup('speechRules', [ ['chromvox-default', 'Verbose'], ['chromevox-short', 'Short'], ['chromevox-alternative', 'Alternative']