Update refocus from menu actions, and adjust some options #1245
+83
−71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theroleDescription
option to the explorer'sa11y
options, so it can be configured even when the menu component is not loaded, and removes theinternalSpeechTitles
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
makeroleDescription
ana11y
option for the document.In
KeyExplorer.ts
, we clear thenofocus
setting after it is used, and change the button checking frombutton !== 0
tobutton === 2
when checking for right mouse buttons that will cause context-menu events.In
GeneratorPool.ts
the setting of the options in theinit()
function is always done, so that if the menu changesenableSpeech
orenableBraille
and does a re-render of the output (which callsinit()
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'srefocus
value to the node that was selected before the menu opened. Because there are focus changes that clear the selection before thecontextmenu
event is triggered, we use amousedown
event 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 newpostInfo()
method that records thenofocus
value before posting anInfo
orSelectableInfo
dialog box. This is used for all the.post()
commands in the menu.The
roleDescription
setting now usesa11yVar<string>()
so we don't need to callsetA11yVar()
by hand insetRoleDescrition()
.We add some checks to make sure
options.displayOverflow
andoptions.linebreak
are available (since these are defined inoutput/common.ts
, and may not be in all output jax).We check for
MathJax._.a11y.explorer
rather than justMathJax._.a11y.speech
or the other extensions, since we loadexplorer
. 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 anInfo
instance, sopostInfo()
isn't being called for this).Finally, we remove the
data-speech-node
attributes that where introduced by the explorer update.