Page MenuHomePhabricator

<math display=block> sometimes creates unnecessary vertical scrollbars which hijack readers' attempts to scroll
Closed, DuplicatePublicBUG REPORT

Description

I pasted some examples at Wikipedia: WikiProject Mathematics, but for concreteness here's an example bit of LaTeX which results in such a scrollbar (in Mac Safari, iPad Safari, Firefox, and Chrome):

<math display="block">\begin{align}
  t' &= \gamma \left( t - \frac{vx}{c^2} \right ), \\[2pt]
  x' &= \gamma \left( x - vt \right ).
\end{align}</math>

Such formulas should have no problem fitting in view, but somewhere in the nested set of elements that draw the formula (SVG inside a couple nested divs) some HTML element is set to a size that is just slightly vertically smaller than its contents. Since the box is set to scroll on overflow, the result is an entirely pointless scrollbar appearing at the right side.

That eyesore would be bad enough, but the real problem is that when a reader puts their mouse over that region of the article and tries to scroll using a mouse wheel or trackpad gesture (or on a touch screen, if they try to touch and drag that region of the article to scroll), the browser gets confused and sometimes (though not always) scrolls the math box instead of the whole page. The math box will then scroll by a pixel or two up and down, but the whole page will be left standing still, thwarting the reader's scrolling intention.

I suspect there's some kind of rounding errors involved in computing the box sizes which result in a computed size that is just slightly smaller than the contents. Perhaps there are some fractional pixels involved which should be rounded up instead of down? I haven't deeply investigated though.