Skip to content

Commit 586ee79

Browse files
committed
Setting Hover or Flame sets Collapsible Math automatically
1 parent 0a18ed5 commit 586ee79

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

ts/ui/menu/Menu.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ export class Menu {
498498
this.a11yVar<boolean>('speech', speech => this.setSpeech(speech)),
499499
this.a11yVar<boolean>('braille', braille => this.setBraille(braille)),
500500
this.variable<string>('brailleCode', code => this.setBrailleCode(code)),
501-
this.a11yVar<string> ('highlight'),
501+
this.a11yVar<string> ('highlight', value => this.setHighlight(value)),
502502
this.a11yVar<string> ('backgroundColor'),
503503
this.a11yVar<string> ('backgroundOpacity'),
504504
this.a11yVar<string> ('foregroundColor'),
@@ -1015,8 +1015,11 @@ export class Menu {
10151015
protected setCollapsible(collapse: boolean) {
10161016
this.document.options.enableComplexity = collapse;
10171017
if (collapse && !this.settings.enrich) {
1018-
this.settings.enrich = true;
1019-
this.setEnrichment(true);
1018+
this.settings.enrich = this.document.options.enableEnrichment = true;
1019+
this.setAccessibilityMenus();
1020+
}
1021+
if (!collapse) {
1022+
this.menu.pool.lookup('highlight').setValue('None');
10201023
}
10211024
if (!collapse || MathJax._?.a11y?.complexity) {
10221025
this.rerender(STATE.COMPILED);
@@ -1028,6 +1031,21 @@ export class Menu {
10281031
}
10291032
}
10301033

1034+
/**
1035+
* @param {string} value The value that highlighting should have
1036+
*/
1037+
protected setHighlight(value: string) {
1038+
if (value === 'None') return;
1039+
if (!this.settings.collapsible) {
1040+
//
1041+
// Turn on collapsible math if it isn't already
1042+
//
1043+
const variable = this.menu.pool.lookup('collapsible');
1044+
variable.setValue(true);
1045+
(variable as any).items[0]?.executeCallbacks_?.();
1046+
}
1047+
}
1048+
10311049
/**
10321050
* Request the scaling value from the user and save it in the settings
10331051
*/

0 commit comments

Comments
 (0)