Skip to content

Update refocus from menu actions, and adjust some options #1245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: update/explorer
Choose a base branch
from

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Apr 28, 2025

This PR is an update to update/explorer that fixes some problems with refocusing the selected item when the menu is use from within the explorer, particularly when the menu selection opens a dialog. It also moves the roleDescription option to the explorer's a11y options, so it can be configured even when the menu component is not loaded, and removes the internalSpeechTitles option, which is no longer supported since the speech is added to the DOM elements after the output is created.

The changes in explorer.ts make roleDescription an a11y option for the document.

In KeyExplorer.ts, we clear the nofocus setting after it is used, and change the button checking from button !== 0 to button === 2 when checking for right mouse buttons that will cause context-menu events.

In GeneratorPool.ts the setting of the options in the init() function is always done, so that if the menu changes enableSpeech or enableBraille and does a re-render of the output (which calls init() again), the options will be updated.

The changes to the SVG output jax are to remove the internalSpeechTitles option and the code that implements it.

The changes to the menu code is to better set the MathItem.outputData.nofocus and to set the speech explorer's refocus value to the node that was selected before the menu opened. Because there are focus changes that clear the selection before the contextmenu event is triggered, we use a mousedownevent to record the current selection before it is lost.

When a dialog is opened by a menu action, we need to keep the nofocus value, so introduce a new postInfo() method that records the nofocus value before posting an Info or SelectableInfo dialog box. This is used for all the .post() commands in the menu.

The roleDescription setting now uses a11yVar<string>() so we don't need to call setA11yVar() by hand in setRoleDescrition().

We add some checks to make sure options.displayOverflow and options.linebreak are available (since these are defined in output/common.ts, and may not be in all output jax).

We check for MathJax._.a11y.explorer rather than just MathJax._.a11y.speech or the other extensions, since we load explorer. This makes sure the explorer is available, not just the lesser extension.

We add code to tell the explorer where to refocus when the scale dialog box is open (it uses prompt() rather than an Info instance, so postInfo() isn't being called for this).

Finally, we remove the data-speech-node attributes that where introduced by the explorer update.

…tion, and remove internalSpeechTitles for SVG output
@dpvc dpvc requested a review from zorkow April 28, 2025 17:47
@dpvc dpvc added this to the v4.0 milestone Apr 28, 2025
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

With the exception mentioned in PR #1241, we solve those in the next PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants