Skip to content
14 changes: 14 additions & 0 deletions source/NVDAObjects/IAccessible/ia2Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Optional,
Tuple,
)
import re
from ctypes import c_short
from comtypes import COMError, BSTR
from comtypes.hresult import E_NOTIMPL
Expand Down Expand Up @@ -330,6 +331,19 @@ class EditorChunk(Ia2Web):

class Math(Ia2Web):
def _get_mathMl(self):
# Chromium browsers now expose a 'math' IAccessible2 attribute,
# which contains all the raw mathML.
Comment thread
RyanMcCleary marked this conversation as resolved.
Resolved
# Check for this attribute first before falling back to ISimpleDOM.
mathAttr = self.IA2Attributes.get("math")
if mathAttr:
# Chromium sometimes embeds HTML comments in the MathML, strip them
mathAttr = re.sub(r"<!--.*?-->", "", mathAttr, flags=re.DOTALL)

langAttr = f' xml:lang="{self.language}"' if self.language else ""
mathMl = f"<math{langAttr}>{mathAttr}</math>"
log.debug(f"Got MathML from IA2 math attribute: {mathMl!r}")
Comment thread
RyanMcCleary marked this conversation as resolved.
Resolved
return mathMl

from comtypes.gen.ISimpleDOM import ISimpleDOMNode # type: ignore[reportMissingImports]

try:
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ This is more noticeable for Windows releases which are enablement packages on to
* Capital indicators are now correctly announced when selecting single characters. (#19505, @cary-rowen)
* Configuration profile triggers now activate when the Add-on Store is open. (#19583, @bramd)
* After cancelling an add-on download and reopening the Add-on Store, downloading another add-on no longer fails. (#20015, @Cary-rowen)
* MathML in Chromium is more reliably read after NVDA starts or restarts. (#19813, @RyanMcCleary)
* Decorative Unicode letters such as negative squared, negative circled, and regional indicator symbol characters are now normalized to their base Latin letters when Unicode normalization is enabled. (#19608, @bramd)
* NVDA no longer crashes when the Add-on Store download directory cannot be cleaned up due to file permission errors. (#19202, @christopherpross)
* Fixed NVDA freezing when navigating in JetBrains IDEs. (#16741, @christopherpross)
Expand Down
Loading