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 cannot navigate math content in Chromium #17421

Closed
cary-rowen opened this issue Nov 21, 2024 · 20 comments · Fixed by #17548
Closed

NVDA cannot navigate math content in Chromium #17421

cary-rowen opened this issue Nov 21, 2024 · 20 comments · Fixed by #17548
Labels
app/chrome blocked/needs-external-fix p2 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@cary-rowen
Copy link
Contributor

cary-rowen commented Nov 21, 2024

This is most likely a Chromium regression, but it's unclear which version introduced it. I hope the community can provide more information. In the meantime, I will report this issue to the Chromium team.

Steps to reproduce:

  1. Open the following Wikipedia page: https://en.wikipedia.org/wiki/Quadratic_equation
  2. Use NVDA to locate the mathematical content on the page. You can use Single Letter Navigation commands.
  3. Press the space key on the math content to try interacting with it.
  4. Use the left/right arrow keys to navigate the math content.

Actual behavior:

  • Step 3: Unable to enter interactive mode.
  • Step 4: Unable to navigate or find the math object.

Note: Using object navigation (NVDA+numpad4/6), you can locate the mathematical content, but interaction is still not possible.

Expected behavior:

NVDA should be able to interact with math content in Chromium, just like it does in Firefox.

NVDA logs, crash dumps, and other attachments:

System configuration:

NVDA installed/portable/running from source:

Installed

NVDA version:

2024.4.1 (Alpha snapshot)

Windows version:

Windows 10 22H2 (AMD64) Build 19045.5131

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

Chrome 131.0.6778.86

Other information about your system:

None

Other questions:

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please describe their behavior:

The issue can be reproduced in versions 2024.1, 2024.2, and 2024.3.

If NVDA add-ons are disabled, does the problem still occur?

Yes

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

Yes

@cary-rowen
Copy link
Contributor Author

Hi cc @NSoiffer
Can you take a look at this?

Many thanks

@NSoiffer
Copy link
Contributor

It worked for me yesterday or the day before that on Chrome. I don't remember what the version was. Version 131.0.6778.71 and the just updated Version 131.0.6778.86 are not triggering the calls to MathCAT. Everything is working in Firefox. Edge Version 131.0.2903.51 has the same problem as Chrome (not surprisingly). The problem is also there in Chrome Canary Version 133.0.6849.0.

I suspect the stable build on Nov 12 (131.0.6778.70) was working. However, Google doesn't make it easy download old versions and I failed in my attempt to download that version.

Note 1: on my Windows 10 computer, there is no speech period, let alone the ability to navigate it.

Note 2: NVDA 2025.1 alpha builds fails for navigation of math with MathCAT due to a problem in NVDA's braille code. That's a separate issue that I hope to file a bug report on in the next few days. It is not a problem for 2024.4 (or 2024.4.1).

@Adriani90
Copy link
Collaborator

If you report this to Chromium as well, please post the link here so we can track it as well.

@SasnikOmega
Copy link

I have the same problem. Heres what I noticed.
Looking at detailed info about the current navigator object using NVDA f1, theres a property called "IAccessible2 attributes".
Usually its value looks like this:
IAccessible2 attributes: 'display:block;tag:p;text-align:left;'. Or, in case of math objects:
IAccessible2 attributes: 'display:block math;tag:math;text-align:left;'.
In last versions of Chromium-based browsers though, NVDA considers math content itself as the part of IAccessible2 attributes. It looks like this:
IAccessible2 attributes: 'display:block math;tag:math;text-align:left;math:\n<mrow>\n <mi>x</mi>\n <mo>\\=</mo>\n <mfrac>\n <mrow>\n <mrow>\n <mo>-</mo>\n <mi>b</mi>\n </mrow>\n <mo>±</mo>\n <msqrt>\n <mrow>\n <msup>\n <mi>b</mi>\n <mn>2</mn>\n </msup>\n <mo>-</mo>\n <mrow>\n <mn>4</mn>\n <mo>\u2062</mo>\n <mi>a</mi>\n <mo>\u2062</mo>\n <mi>c</mi>\n </mrow>\n </mrow>\n </msqrt>\n </mrow>\n <mrow>\n <mn>2</mn>\n <mo>\u2062</mo>\n <mi>a</mi>\n </mrow>\n </mfrac>\n</mrow>\n;'
(Source
Unfortunately, thats all I can say. Hope that helps though.

@NSoiffer
Copy link
Contributor

FYI: here is the Chromium bug report: https://issues.chromium.org/issues/380161205.

@cary-rowen
Copy link
Contributor Author

Thanks @NSoiffer

@cary-rowen
Copy link
Contributor Author

Thanks @SasnikOmega

The information you provided may be useful and I will update the progress of the original bug here.

@aleventhal
Copy link

aleventhal commented Nov 25, 2024

I'm guessing that Chrome needs to strip out the newlines so that it doesn't break parsing of the object attributes. It wouldn't have been an issue when NVDA retrieved the math through ISimpleDOMNode::get_innerHTML because it doesn't need to break that string up into multiple attributes.

@cary-rowen
Copy link
Contributor Author

Yes, thanks to the Chromium engineers for working on this.

Let's keep an eye on the canary version.

aarongable pushed a commit to chromium/chromium that referenced this issue Nov 26, 2024
IA2 attributes are provided in a single string buffer, and each line is
supposed to contain a separate attribute. However, if mathml or any
other content has newlines, it will break this expectation and
downstream parsers will not understand the input.

Bug: nvaccess/nvda#17421
Bug: 380161205
Change-Id: I21f9c96d4afa2e6ece1bf121f80c8de7a5e6e773
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6051056
Reviewed-by: Tzarial <zork@chromium.org>
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Tzarial <zork@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1387968}
@seanbudd seanbudd added blocked/needs-external-fix p2 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation. app/chrome labels Nov 26, 2024
@NSoiffer
Copy link
Contributor

NSoiffer commented Dec 3, 2024

I've been in contact with the developers and got this response:

It seems that the issue is that we return E_NOTIMPL from ISimpleDOMNode::get_attributesForNames() now. If it's changed so that we return S_FALSE or S_OK, then the math is spoken as expected. We don't even have to return the attribute, but we can't return an error.

I checked NVDAObjects.IAccessible.ia2Web.Math._get_mathMl and indeed, the call
node.attributesForNames(1, attrNames, namespaceIds)
returns

DEBUGWARNING - NVDAObjects.IAccessible.ia2Web.Math._get_mathMl (16:05:01.897) - MainThread (5344):
Error retrieving math. Not supported in this browser or ISimpleDOM COM proxy not registered.
Traceback (most recent call last):
  File "NVDAObjects\IAccessible\ia2Web.py", line 341, in _get_mathMl
    attr = node.attributesForNames(1, attrNames, namespaceIds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Dev\nvda\.venv\Lib\site-packages\comtypes\_memberspec.py", line 523, in __call__
    return self.fget(self.instance, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ctypes.COMError: (-2147467263, 'Not implemented', (None, None, None, 0, None))

There is some trickery in generating the COM call, so I don't know if this is fixable via an NVDA change or not. Does anyone more knowledgeable know?

FYI: I checked JAWS and JAWS doesn't have a problem with Chrome.

@cary-rowen
Copy link
Contributor Author

Chromium may roll back some changes at a later date to restore the math reading experience for NVDA users.
But @NSoiffer's comment is still worth noting.

cc @jcsteh
cc @michaelDCurran

Can you take a look at @NSoiffer's comment and make some comments?
I can talk to the Chromium engineers directly, but I don't quite understand what NVDA is supposed to do.
JAWS in particular is not affected by this change.

@NSoiffer
Copy link
Contributor

NSoiffer commented Dec 3, 2024

I wrote my earlier message a little hastily as I needed to make dinner. The obvious thing to do is to catch the error. I added try/except:

			try:
				attr = node.attributesForNames(1, attrNames, namespaceIds)
			except COMError:
				attr = None

and the math was back to working. Then I tried to be more specific and catch just E_NOTIMPL, but messed something up and now .\runnvda.bat is stuck running something other than the current code (some version with different debug messages). I ran into this before, but can't remember the easy solution and I need to call it quits for today. Maybe someone can take the ball from here.

@aleventhal
Copy link

aleventhal commented Dec 3, 2024 via email

@CyrilleB79
Copy link
Collaborator

@seanbudd, @gerald-hartig given the last comments, could NV Access quickly indicate if they plan to provide a quick fix themselves or if they need Chromium (@aleventhal) to temporarily change again the behavior of the API.

This is an important blocking issue for whoever is working with math content and has no choice of the used browser.

Also, if there is a workaround or an add-on/script to have this fixed temporarily, please let it know. Thanks.

aarongable pushed a commit to chromium/chromium that referenced this issue Dec 4, 2024
Return S_FALSE, which is considered a successful call, and circumvents
NVDA's lack of a try/catch for the E_NOTIMPL error case.
NVDA was still attempting to use this method to retrieve a deprecated
 non-standard attribute called data-math, but when the call fails
with E_NOTIMPL NVDA stops processing the equation. If we instead
return S_FALSE, NVDA moves on to other ways of retrieving the math,
which still work.

Bug: nvaccess/nvda#17421
Change-Id: Iba6d8df8f7d746e44dec1e0c68dca738662fa969
Fixed: 380161205
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6069951
Reviewed-by: Tzarial <zork@chromium.org>
Commit-Queue: Javier Contreras <javiercon@microsoft.com>
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Javier Contreras <javiercon@microsoft.com>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391947}
@cary-rowen
Copy link
Contributor Author

cc @seanbudd
cc @gerald-hartig
Can you please comment here?

@michaelDCurran
Copy link
Member

NV Access and Google are collaborating on this and have been speaking offline. We'll share updates when they are available.

@cary-rowen
Copy link
Contributor Author

Fixed in 133.0.6878.0 canary.
Thanks @aleventhal

@Adriani90
Copy link
Collaborator

As far as I understand the fix in Canary is only temporarily, so on a longer term a fix on NVDA‘s side is needed, is this correct?

aarongable pushed a commit to chromium/chromium that referenced this issue Dec 9, 2024
Return S_FALSE, which is considered a successful call, and circumvents
NVDA's lack of a try/catch for the E_NOTIMPL error case.
NVDA was still attempting to use this method to retrieve a deprecated
 non-standard attribute called data-math, but when the call fails
with E_NOTIMPL NVDA stops processing the equation. If we instead
return S_FALSE, NVDA moves on to other ways of retrieving the math,
which still work.

(cherry picked from commit 501cd72)

Bug: nvaccess/nvda#17421
Change-Id: Iba6d8df8f7d746e44dec1e0c68dca738662fa969
Fixed: 380161205
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6069951
Reviewed-by: Tzarial <zork@chromium.org>
Commit-Queue: Javier Contreras <javiercon@microsoft.com>
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Javier Contreras <javiercon@microsoft.com>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1391947}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6077791
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/6834@{#1847}
Cr-Branched-From: 47a3549-refs/heads/main@{#1381561}
aarongable pushed a commit to chromium/chromium that referenced this issue Dec 9, 2024
IA2 attributes are provided in a single string buffer, and each line is
supposed to contain a separate attribute. However, if mathml or any
other content has newlines, it will break this expectation and
downstream parsers will not understand the input.

(cherry picked from commit 95d88bc)

Bug: nvaccess/nvda#17421
Bug: 380161205
Change-Id: I21f9c96d4afa2e6ece1bf121f80c8de7a5e6e773
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6051056
Reviewed-by: Tzarial <zork@chromium.org>
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Tzarial <zork@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1387968}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6080153
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/6834@{#1850}
Cr-Branched-From: 47a3549-refs/heads/main@{#1381561}
NSoiffer added a commit to NSoiffer/nvda that referenced this issue Dec 15, 2024
…ange that causes a call to (correctly) return E_NOTIMPL.

This simple fix catches the exception and moves on. The behavior should be the same as before the Chromium change. Only E_NOTIMPL is caught, other COMErrors are re-raised.

Fixes nvaccess#17421
@NSoiffer
Copy link
Contributor

I've committed the fix/PR.

Apologies for the delay: my desktop has COM issues (I think too much mucking about with COM stuff) and stopped handling ISimpleDOM. I have a new laptop and after a painful process of getting it all setup, I was able to essentially add the code I mentioned above.

With the fix, the math goes from broken to working in Chrome.

@aleventhal
Copy link

Thanks @NSoiffer . We also merged the fix into Chrome 132.0.6834.46, the current beta.

Chrome 132 will be released to stable in mid-January.
Early Stable Release Jan 8
Stable Release Jan 14

Users can force the update starting January 8 by visiting Help -> About.

seanbudd pushed a commit that referenced this issue Dec 16, 2024
…ange that causes a call to (correctly) return E_NOTIMPL.

This simple fix catches the exception and moves on. The behavior should be the same as before the Chromium change. Only E_NOTIMPL is caught, other COMErrors are re-raised.

Fixes #17421
@SaschaCowley SaschaCowley added this to the 2024.4.2 milestone Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app/chrome blocked/needs-external-fix p2 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
9 participants