Skip to content
Open
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
3 changes: 2 additions & 1 deletion ts/a11y/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export function ExplorerMathDocumentMixin<
public static OPTIONS: OptionList = {
...BaseDocument.OPTIONS,
enableExplorer: hasWindow, // only activate in interactive contexts
enableExplorerHelp: true, // help dialog is enabled
renderActions: expandable({
...BaseDocument.OPTIONS.renderActions,
explorable: [STATE.EXPLORER]
Expand Down Expand Up @@ -441,7 +442,7 @@ export function ExplorerMathDocumentMixin<
'text-align': 'right',
},
'.mjx-help-dialog::backdrop': {
opacity: .75,
opacity: 0.75,
},
'mjx-help-dialog': {
'font-style': 'normal',
Expand Down
23 changes: 19 additions & 4 deletions ts/a11y/explorer/KeyExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,13 @@ export class SpeechExplorer

/**
* Open the help dialog, and refocus when it closes.
*
* @returns {boolean | void} True cancels the event
*/
protected hKey() {
protected hKey(): boolean | void {
if (!this.document.options.enableExplorerHelp) {
return true;
}
this.refocus = this.current;
this.help();
}
Expand Down Expand Up @@ -933,6 +938,9 @@ export class SpeechExplorer
* Displays the help dialog.
*/
protected help() {
if (!this.document.options.enableExplorerHelp) {
return;
}
const isDialog = !!window.HTMLDialogElement;
const adaptor = this.document.adaptor;
const helpBackground = isDialog
Expand Down Expand Up @@ -1081,7 +1089,10 @@ export class SpeechExplorer
if (describe) {
let description =
this.description === this.none ? '' : ', ' + this.description;
if (this.document.options.a11y.help) {
if (
this.document.options.a11y.help &&
this.document.options.enableExplorerHelp
) {
description += ', press h for help';
}
speech += description;
Expand Down Expand Up @@ -1557,7 +1568,9 @@ export class SpeechExplorer
// and add the info icon.
//
this.node.classList.add('mjx-explorer-active');
this.node.append(this.document.infoIcon);
if (this.document.options.enableExplorerHelp) {
this.node.append(this.document.infoIcon);
}
//
// Get the node to make current, and determine if we need to add a
// speech node (or just use the top-level node), then set the
Expand Down Expand Up @@ -1593,7 +1606,9 @@ export class SpeechExplorer
this.node.setAttribute('aria-roledescription', description);
}
this.node.classList.remove('mjx-explorer-active');
this.document.infoIcon.remove();
if (this.document.options.enableExplorerHelp) {
this.document.infoIcon.remove();
}
this.pool.unhighlight();
this.magnifyRegion.Hide();
this.region.Hide();
Expand Down
1 change: 1 addition & 0 deletions ts/ui/menu/MenuHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export function MenuMathDocumentMixin<B extends A11yDocumentConstructor>(
enableSpeech: true,
enableBraille: true,
enableExplorer: true,
enableExplorerHelp: true,
enrichSpeech: 'none',
enrichError: (_doc: MenuMathDocument, _math: MenuMathItem, err: Error) =>
console.warn('Enrichment Error:', err),
Expand Down