Add visual highlighting for web math navigation - #20372
Conversation
|
Very nice surprise to see this PR! Thanks @RyanMcCleary. I have not tested yet but have already somme questions. Given this PR takes into account a location for the subpart being read in the math equation, what about the new Magnifier? Does it follow? In a foreseable future, it would be nice that magnifier can follow the subpart being read, at least in math exploration/navigation mode.If it follows, to which type of tracking is it tied? System focus (which also includes browse mode cursor when applicable)? |
|
@CyrilleB79 The magnifier does not yet follow the highlighted subparts. My thinking was that we could handle that in a follow-up PR. As for the type of tracking, system focus seems like the logical choice. I do still have a couple open questions about this PR where I'd welcome your input. The math highlighter as it's implemented here is a an entirely new highlighter with its own highlighting color (orange). Do you think it should be included in the browse mode highlighter? I can see arguments both for and against this. On the one hand, including it in the browse mode highlighter is simpler and doesn't require adding a new highlighter. On the other hand, math interaction is separate from browse mode, and although it's usually activated from browse mode now, there might be other ways to activate it in the future. Thoughts? |
|
Yes, Magnifier tracking can be implemented in a follow-up PR. It's even preferable to keep PRs not too big to ease review. I have just mentioned it so that you have it in mind since both features may be related. My opinion is that browse mode cursor highlighter should be used in this case; the same color should be kept. I agree that this is discutable though.
|
|
Note, I've tested this PR and highlighting is working well. Thanks! |
|
Interesting point re: navigating OCR results. Given that there's already a precedent for this, it does seem like a good idea to use browse mode highlighting. I'll update the PR with that change. |
|
Hi @CyrilleB79 Yes, I felt there was still more need for testing on my part before marking it as ready again, and it was my plan to spend some more time going over it last week. I ended up having to catch up on other work though, and I'm hoping to get to it today or tomorrow. |
|
No problem. Thanks @RyanMcCleary for this update and many thanks again for this work. |
…hod for compatibility with addons
|
I've done some more testing using Wikipedia (e.g., the article on the central limit theorem). I've found that some highlights, especially in larger expressions, are appearing in the wrong place. This seems to be due to the fact that Wikipedia renders math visually as an image while exposing the (visually hidden) MathML for screen readers separately. |
|
Can we detect if the browser uses SVG/Image instead of direct rendering? If yes, we should unfortunately disable highlighting there. And maybe push against Wikipedia to use native rendering when available. Alternatively, a browser script modifying the native rendering could probably do the trick but not sure it can be managed by NVDA... |
|
@CyrilleB79 This will require a bit of work to get right - I'll spend some time thinking about it and let you know what I come up with. The difficulty is that there are multiple ways the browser can use SVG/images instead of directly rendering MathML, and the DOM and accessibility tree can look different depending on how it's done. It might not be possible to detect in all cases, but we can probably put together a heuristic that works most of the time. |
|
After spending a bit more time thinking this over, I'm wondering if we should rethink the general approach. Another approach brought up by @NSoiffer in #19191 is to implement highlighting "by making all navigation to be in a separate window (which I believe is an HTML object)." Even though this seems more disruptive than the approach of this PR, I am wondering if it might be justified by the fact that it avoids the type of difficulties that I discussed earlier in #20372 (comment) where math is rendered as an SVG/image. Using a separate window would allow us to have more control and avoid these types of issues where the highlights are in the wrong place. |
|
Marking this as draft again while these higher level questions are still being resolved. |
|
Maybe we can implement the separate window only as a fallback case if native hilighting is not available ormay be shifted as in svg case. |
|
My main concern with that is the unpredictability involved from the user's standpoint. If you imagine you're moving down a page interacting with math, and there's no way to tell before interacting with it whether it will be inline or in a separate window, it seems like that might be quite confusing. That might be acceptable for some users though. Perhaps we could have a setting for "math interaction display" with the following three options:
|
Link to issue number:
Part of #19191.
Summary of the issue:
When navigating math, there is currently no visual highlighting showing the focused subpart. Visual highlighting is very useful for low-vision users and can make it easier to use speech and magnification together while reading math.
Description of user facing changes:
When browse mode highlighting is enabled, the currently focused subpart is now highlighted while navigating math on the web. Similarly to how highlighting is handled for OCR results, math navigation highlighting is included in browse mode highlighting.
Description of developer facing changes:
The
MathCATInteractionclass now takes a source object as a constructor parameter (the source object is the root of the MathML being interacted with). A new filesource\mathPres\MathCAT\navNodeMapping.pywas also added. This file contains functions that are used to map from MathCAT's current navigation node to the corresponding IA2 object.Description of development approach:
The main tricky part here was mapping MathCAT's current navigation node to the position of that MathML element on the screen. This is done by mapping element IDs to the corresponding IA2 object, from which the position information can be retrieved. One wrinkle in this process was MathCAT creates its own internal IDs for elements that don't already have IDs, so it was necessary to preprocess the MathML to create IDs for elements that don't have them.
Testing strategy:
Unit testing and manual testing in Chrome and Firefox.
Known issues with pull request:
The only issue I know of is the possibility that there might be a more general solution. If it is possible to implement this so that it works for Microsoft Word, Outlook, Acrobat, etc. as well, then that solution might be preferred. However, it seems likely to me that those cases will need to be handled separately.
Code Review Checklist: