Skip to content

Commit

Permalink
Fix math not being read in Chromium-based browsers (#17421) (#17548)
Browse files Browse the repository at this point in the history
Fixes #17421

Summary of the issue:
Chromium-browsers were changed to return E_NOTIMPL and broke speech and braille of all math equations (i.e., no speech or braille for math) in those browsers because NVDA passes along a 'not implemented' COM exception.

Description of user facing changes
This restores the behavior of NVDA (i.e., math reads) as before the change.

Description of development approach
A try/except block is added around the call. If the error is E_NOTIMPL, the code moves on as before. Otherwise, the error is re-raised as before.
  • Loading branch information
NSoiffer authored Dec 19, 2024
1 parent e8ebe86 commit 9390788
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion source/NVDAObjects/IAccessible/ia2Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)
from ctypes import c_short
from comtypes import COMError, BSTR
from comtypes.hresult import E_NOTIMPL

import oleacc
from annotation import (
Expand Down Expand Up @@ -334,7 +335,13 @@ def _get_mathMl(self):
# Try the data-mathml attribute.
attrNames = (BSTR * 1)("data-mathml")
namespaceIds = (c_short * 1)(0)
attr = node.attributesForNames(1, attrNames, namespaceIds)
try:
attr = node.attributesForNames(1, attrNames, namespaceIds)
except COMError as e:
if e.hresult != E_NOTIMPL:
log.debugWarning(f"MathML getting attr error: {e}")
raise
attr = None
if attr:
import mathPres

Expand Down
5 changes: 4 additions & 1 deletion user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

## 2024.4.2

### Bug Fixes
This is a patch release to fix bugs with braille devices and reading math in Chromium.

### Bug fixes

* Fixed bug with with reading math in Chromium Browsers (Chrome, Edge). (#17421, @NSoiffer)
* Humanware Brailliant BI 40X devices running firmware version 2.4 now work as expected. (#17518, @bramd)

## 2024.4.1
Expand Down

0 comments on commit 9390788

Please sign in to comment.