Skip to content
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

NVDA can only work with built-in "Word Math" or with MathType math depending on UIA settings #17554

Open
NSoiffer opened this issue Dec 19, 2024 · 3 comments

Comments

@NSoiffer
Copy link
Contributor

Word Math works UIA and MathType Math (which is an embedded object) works with MSAA. It's long been a frustration that you need to go to the "Advanced" settings and change the UIA settings "Use UI Automation to access Microsoft Word document controls" to hear the math depending upon what software authored the math.

I'd like to carve out an exception if the value of the UIA in Word is "Always". This value works with Word Math but not with MathType Math. The exception would recognize the MathType object and switch to MSAA for that. I spent some time trying to find where a check might go, but I was unsuccessful due to my limited knowledge of the code. If you agree that making NVDA smarter about the Word and MathType math is a good idea, I'd appreciate some pointers of where I might add a check.

Steps to reproduce:

Note: you probably need MathType installed to hear the MathType equation. You can download the free demo version from here.

  1. Install the MathCAT or MathPlayer addon (restart).
  2. In Settings:General:Advanced, after clicking on the "I accept..." button, set the value of "Use UI Automation to access Microsoft Word document controls" to "Where suitable". Click "accept".
  3. Open the document UIAorMSAA_Math.docx and navigate to the first equation (in the "MathType Math" section). It should speak something like "the square root of x squared plus y squared".
  4. Move down to the next equation in the "Word Math" section. It should speak something like "fraction x squared over y cubed". However, with the UIA setting, you'll just hear "x", "2", etc.
  5. Go back to the advanced tab and change the Word UIA value to "Always" and click accept.
  6. Now the Word math should speak as a fraction.
  7. Move back to the MathType equation. It now says something like "blank" or "Graphic MathType 6.0 equation" depending on where in the line you are.

Actual behavior:

See "steps to reproduce"

Expected behavior:

Users should not need to play with advanced settings to hear math.

NVDA logs, crash dumps and other attachments:

System configuration

NVDA installed/portable/running from source:

Installed.

NVDA version:

2024.4.1, but has happened for years (even when the UIA options were experimental).

Windows version:

Windows 10

Name and version of other software in use when reproducing the issue:

Any version of MathType, MathPlayer/MathCAT

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

yes -- same behavior for years

If NVDA add-ons are disabled, is your problem still occurring?

you need a math addon to hear the math

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

yes

@CyrilleB79
Copy link
Collaborator

Related to #17475 which has been closed.

In #17475 (comment), @seanbudd you write:

Closing as can't reproduce with the default setting. For the case "only necessary", this cannot be fixed.

If this issue is closed for the same reason, a more detailed explanation on the "why" would be welcome. E.g. why couldn't there be a parameter to define specifically the interface used for equations in Word?
Thanks.

Also related even if not totally in topic here:
The realty is that several people change the value of "Use UI Automation to access Microsoft Word document controls" combo-box according to their needs. Given this matter of facts, this options should not be in advanced settings anymore.

@NSoiffer
Copy link
Contributor Author

@CyrilleB79: I missed that when I looked for related issues because I only looked at open ones -- thanks for finding that.

When I was looking through the code to find a spot to special case the MathType object, I found an example where the code bounces between UIA and MSAA (or at least I think that is what is going on). In source\UIAHandler\__init__.py in the function IUIAutomationFocusChangedEventHandler_HandleFocusChangedEvent, there is

if not self.isNativeUIAElement(sender):
    # #12982: This element may be the root of an MS Word document
    # for which we may be refusing to use UIA as its implementation may be incomplete.
    # However, there are some controls embedded in the MS Word document window
    # such as the Modern comments side track pane
    # for which we do have to use UIA.
    # But, if focus jumps from one of these controls back to the document (E.g. the user presses escape),
    # we receive no MSAA focus event, only a UIA focus event.
    # As we are not treating the Word doc as UIA, we need to manually fire an MSAA focus event on the document.
    self._emitMSAAFocusForWordDocIfNecessary(sender)
    if _isDebug():
        log.debug(f"Ignoring for non native element {self.getUIAElementDebugString(sender)}")
    return

So maybe there is precedent for doing the switch in a few special cases.

@NSoiffer
Copy link
Contributor Author

In(the similar issue #13842, @michaelDCurran wrote:

But as I mentioned, we could at very least support it correctly at the caret position.

@michaelDCurran: what's involved in making that happen?

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

No branches or pull requests

2 participants