Update explorer to allow drag selection, handle menu tab-order settings better, and a few other fixes #1131
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 fixes a bunch of small issues with the explorer interface.
It turns off the subtitles and Braille subtitles by default. Currently, since the assistive tools are on by default, anyone clicking on an expression will get these showing up, and that will be a cause of confusion and questions about how to turn it off. Since they are mostly for debugging and demonstration purposes, we can turn them on if we want them.
There were a number of issues centered around the
tabIndex
handling. For one, if the user turns off the "in tab order" option, reloading the page would cause the expression to gettabIndex="0"
even though the menu item was still unchecked. This is due to the fact that the mj-context-menu code doesn't know about the menu setting controlling this, so always sets thetabIndex
to 0, and is resolved in the menu code when elements are added to the menu store.Currently, even when
tabIndex
is set to-1
, you can still click on the equation to focus it. Is that how it is supposed to be? I'm thinking that the "in tab order" menu item would be an easy way to disable the explorer without losing the enrichment and even still allowing the speech to be attached. So The click handler exits iftabIndex
is-1
. If you don't like that, new line 202 can be removed.When subtitles or Braille subtitles are turned off, the changes I made to the handling of the regions for these allow them to remain visible anyway. So I've added back some of the CSS that was removed in order to get the display of these regions to be handled properly.
The problem we discussed in our meeting a few weeks ago concerning arrow keys moving from one expression to the next is resolved here in the
nextSibling()
andprevSibling()
methods. If the current expression is the top-levelmath
element, then these currently move you to the next or previous expression (and don't properly remove highlighting). The fist here is to check that the current node has adata-semantic-parent
before looking for a sibling.In
FocusOut()
we blur the current item, which avoids some unexpected focusing in some circumstances (such as when the window is no longer focused and then gets focus again).The remaining changes have to do with better handling of clicks so that you can drag-select portions of the output for example, or shift-click to extend a selection, etc. Here, the mouse-down handler clears any selection unless one of the modifier keys (shift, alt, meta, control) is pressed, which might be used to extend selections, etc. Then in the click handler, if there is now a selection, that must have come from dragging the mouse to cause that selection, so we don't do the usual click action in that case. We also skip it if any modifier key is down (e.g., if we are extending the selection).