Skip to content

Fix problem with maction toggles scrolling to the top of the page. (mathjax/MathJax#3600) - #1552

Open
dpvc wants to merge 1 commit into
developfrom
issue3600
Open

Fix problem with maction toggles scrolling to the top of the page. (mathjax/MathJax#3600)#1552
dpvc wants to merge 1 commit into
developfrom
issue3600

Conversation

@dpvc

@dpvc dpvc commented Aug 14, 2026

Copy link
Copy Markdown
Member

This PR fixes a problem with the handling of maction toggles, where clicking a toggle when the window is scrolled moves the window to the top of the page. This was due to the temporary focus element that is added so that we don't lose the focus while the expression is re-rendered (which will cause problems for screen readers).

The solution is to insert the temporary element at the location of the math expression itself rather than at the top of the page. This resolves issue mathjax/MathJax#3600.

While working on this, I also found an issue where clicking on an expression causes the original expression to be read (due to the initial focusing on the mouse down), and then the updated expression when the mouse is released. That leads to confusing spoken expressions, and can even lead to the updated version not being read (if the focus changes fast enough).

The solution in this case seems to be to remove the main expression's speech string (by speaking a blank string) when the mousedown event occurs so that the screen reader doesn't read the whole expression if you click and hold down the mouse button before letting go.

@dpvc
dpvc requested a review from zorkow August 14, 2026 00:20
@dpvc dpvc added this to the v4.2 milestone Aug 14, 2026
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.98%. Comparing base (98619d6) to head (90ec277).
⚠️ Report is 13 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1552      +/-   ##
===========================================
+ Coverage    86.92%   86.98%   +0.06%     
===========================================
  Files          390      390              
  Lines        87859    87766      -93     
  Branches      4983     4983              
===========================================
- Hits         76372    76345      -27     
+ Misses       11487    11402      -85     
- Partials         0       19      +19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Successfully merging this pull request may close these issues.

1 participant