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

semantic enrichment and keyboard focus to element with aria-hidden #3307

Open
jmegginson opened this issue Nov 11, 2024 · 1 comment
Open

Comments

@jmegginson
Copy link

jmegginson commented Nov 11, 2024

When semantic enrichment features of MathJax v4.0.0-beta.7 are enabled, programmatic focus gets set to a <g> element that is a child of <svg> with aria-hidden="true" set. When focus is set to an object that is a descendant of a node with aria-hidden="true" screen readers like JAWS and NVDA will not announce the focused object accurately (or at all).

It is observed that ARIA treeitem roles are set to these <g> tags. This could make sense to set focus to a treeitem only if "Collapsible Math" is enabled but even then the aria-hidden property is set to true on the parent SVG element currently.

To recreate you can add the following JS the Console in dev tools:
document.addEventListener('focusin', function() { console.log('focused: ', document.activeElement) }, true);

With the Console open, navigate with the Tab key and observe that the child <g> elements gain focus when "semantic enrichment" is enabled:
image console showing focused element

The elements panel will reveal that the parent node has aria-hidden="true" applied

image elements panel showing aria-hidden on parent container

Alternatively you can enable JAWS or NVDA and observe that nothing is announced (no ARIA treeitem roles or accessible labels) when navigating with virtual cursors or browse mode(s).

Note: When Semantic Enrichment is turned off, the <mjx-container> gains focus as expected.

It is suggested that programmatic focus remain on the <mjx-container> element like it does with MathJax v3.2.2. This way the aria-label (and any custom role) that is applied to this container can be conveyed and the various semantic enrichment features (speech and/or braille labels) can be announced.

Config:

  • MathJax v4.0.0-beta.7
  • Hidden MathML enabled
  • Braille label generated
@zorkow
Copy link
Member

zorkow commented Nov 13, 2024

Thanks for the report.
Some of the issues you mention are due to our current attempt to use the aria tree paradigm to "talk" to screenreaders rather than the old aria live region approach from v3. We are currently honing this and your feedback on future versions is very welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants