Skip to content

Use IA2 math attribute instead of ISimpleDOM when possible - #20049

Merged
seanbudd merged 10 commits into
nvaccess:masterfrom
RyanMcCleary:ia2-math-attr
May 5, 2026
Merged

seanbudd merged 10 commits into
nvaccess:masterfrom
RyanMcCleary:ia2-math-attr

Conversation

@RyanMcCleary

@RyanMcCleary RyanMcCleary commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Link to issue number:

This serves as a fix for the math reading bug in #19813, but doesn't entirely close that issue since the underlying issue with ISimpleDOM is still present.

Summary of the issue:

NVDA can fail to read MathML in Chromium if the page was already open before NVDA starts or restarts. This seems to be due to ISimpleDOM not being registered.

Description of user facing changes:

Math is more reliably read in Chromium, even when a page is already opened before NVDA starts or restarts.

Description of developer facing changes:

The method Math._get_mathMl now checks the IA2 math attribute before falling back to ISimpleDOM.

Description of development approach:

Update Math._get_mathMl to use the IA2 math attribute when available, strip embedded HTML comments, and return the result wrapped in <math>. If the IA2 math attribute is not available, fall back to the existing ISimpleDOM behavior.

A quick note about the embedded HTML comments: I only realized stripping of HTML comments was necessary after testing an initial implementation. It seems like Chromium inserts HTML comments into the IA2 math attribute, which was causing parse errors in MathCAT.

Testing strategy:

  1. Started Chrome and opened a page containing math.
  2. Ran NVDA from source in debug mode after having already started Chrome.
  3. Moved through the page with NVDA and verified that the math was being read correctly.
  4. Inspected the log and verified that the new debug logs ("Got MathML from IA2 math attribute") were present.
  5. Repeated steps 1-4 with Edge instead of Chrome.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@RyanMcCleary RyanMcCleary changed the title Ia2 math attr Use IA2 'math' attribute instead of ISimpleDOM when possible May 4, 2026
@RyanMcCleary RyanMcCleary changed the title Use IA2 'math' attribute instead of ISimpleDOM when possible Use IA2 math attribute instead of ISimpleDOM when possible May 4, 2026
@RyanMcCleary
RyanMcCleary marked this pull request as ready for review May 4, 2026 06:12
@RyanMcCleary
RyanMcCleary requested a review from a team as a code owner May 4, 2026 06:12
@RyanMcCleary
RyanMcCleary requested review from Copilot and seanbudd May 4, 2026 06:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves MathML retrieval for Chromium-based browsers by preferring the IA2 math attribute (to avoid reliance on ISimpleDOM registration), with a changelog entry documenting improved reliability.

Changes:

  • Prefer IA2 math attribute in Math._get_mathMl and strip embedded HTML comments before returning MathML.
  • Fall back to existing ISimpleDOM-based retrieval when the IA2 math attribute is unavailable.
  • Add a user-facing changelog note about improved MathML reading reliability in Chromium.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
source/NVDAObjects/IAccessible/ia2Web.py Adds IA2 math attribute path for MathML retrieval (with comment stripping) ahead of ISimpleDOM fallback.
user_docs/en/changes.md Documents improved MathML reading reliability in Chromium after NVDA start/restart.

Comment thread source/NVDAObjects/IAccessible/ia2Web.py Outdated
Comment thread source/NVDAObjects/IAccessible/ia2Web.py Outdated
RyanMcCleary and others added 2 commits May 4, 2026 02:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread source/NVDAObjects/IAccessible/ia2Web.py Outdated
RyanMcCleary and others added 2 commits May 4, 2026 02:48
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@pre-commit-ci
pre-commit-ci Bot requested a review from a team as a code owner May 4, 2026 06:53
@pre-commit-ci
pre-commit-ci Bot requested a review from Qchristensen May 4, 2026 06:53
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label May 4, 2026

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @RyanMcCleary

@seanbudd
seanbudd merged commit a9163c7 into nvaccess:master May 5, 2026
35 of 37 checks passed
@github-actions github-actions Bot added this to the 2026.2 milestone May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants