Skip to content

Commit 9390788

Browse files
authored
Fix math not being read in Chromium-based browsers (#17421) (#17548)
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.
1 parent e8ebe86 commit 9390788

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

source/NVDAObjects/IAccessible/ia2Web.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
)
1313
from ctypes import c_short
1414
from comtypes import COMError, BSTR
15+
from comtypes.hresult import E_NOTIMPL
1516

1617
import oleacc
1718
from annotation import (
@@ -334,7 +335,13 @@ def _get_mathMl(self):
334335
# Try the data-mathml attribute.
335336
attrNames = (BSTR * 1)("data-mathml")
336337
namespaceIds = (c_short * 1)(0)
337-
attr = node.attributesForNames(1, attrNames, namespaceIds)
338+
try:
339+
attr = node.attributesForNames(1, attrNames, namespaceIds)
340+
except COMError as e:
341+
if e.hresult != E_NOTIMPL:
342+
log.debugWarning(f"MathML getting attr error: {e}")
343+
raise
344+
attr = None
338345
if attr:
339346
import mathPres
340347

user_docs/en/changes.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
## 2024.4.2
44

5-
### Bug Fixes
5+
This is a patch release to fix bugs with braille devices and reading math in Chromium.
6+
7+
### Bug fixes
68

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

912
## 2024.4.1

0 commit comments

Comments
 (0)