Skip to content

Fix what the explorer's typesetting left: refs, rereads, focus rings, labels - #468

Closed
Deicyde wants to merge 5 commits into
mainfrom
fix/explorer-math-followups
Closed

Deicyde wants to merge 5 commits into
mainfrom
fix/explorer-math-followups

Conversation

@Deicyde

@Deicyde Deicyde commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Draft against main. Jack approved opening it on 2026-10-24, while the lead's session was down. It carries the non-blocking findings of #455's final pass (verdict), and the merge-order session's tests for the site MathJax's two guards, folded in so tests/test_site_mathjax_node.py gets one PR and one review. It adds no command, flag, JSON key or schema.

What changes

  • A bare \ref stays as typed. The page input now sets processRefs: false. With it on, a \ref{x} or \eqref{y} in an explorer summary, outside any formula, was typeset as ??? and (???). Every article formula is delimited, so articles are unaffected.
  • Typeset output is not read again. A pass that adds to the page reads every formula element, the typeset ones included, and MathJax's TeX scan also read the hidden copy each formula keeps for assistive technology. A title whose \text held two \$ got a second, invisible formula there, with a tab stop and garbled speech, and so did a card formula whose text held TeX, such as \text{see \begin{cases}a\end{cases}}. The page and card steps now add mjx-container to skipHtmlTags.
  • The explorer's rows keep their focus rings. The site's rule that clips a block holding a formula (:has(mjx-container) { overflow-x: clip }) matched the rail and relation lists once a row held a formula, which clipped the sides of the rows' focus rings. The explorer's own style now lets its lists overflow sideways, inside panels that scroll; the site stylesheet stays free of explorer rules, and the summary keeps the clipping its four-line clamp needs.
  • A typeset label stays together. A distribution label in the details is a flex container, so a typeset $K$-theory split into flex items and showed as K -theory. Its text now goes in a span of its own.

Tests

  • tests/test_site_mathjax_node.py:
    • The harness records the options the script asks of each document. The explorer test checks the menu-free document for formulas in controls (enableMenu: false, the explorer's render action off) and skipHtmlTags on both page documents.
    • The explorer test adds a summary with a bare \ref and, on the first page, an article formula whose assistive copy holds a pair of dollar signs and a card formula whose copy holds an environment. The explorer's pass typesets neither the reference nor anything in the copies. Dropping processRefs: false or either skipHtmlTags entry fails it.
    • The merge-order session's commit adds test_another_mathjax_release_leaves_every_formula_as_typed and test_a_mathjax_listed_before_the_script_typesets_nothing. Removing either guard from mathjax.py fails its test.
  • tests/test_graph_view_rendering.py pins the explorer's list rule, the label's span, the handle's class toggle, and that search rows and the head's trail stay unmarked.
  • tests/test_dag_viewer_browser.py checks, with the real MathJax, that the head's trail shows its TeX label as typed.

Overlap

#442 and #444 rewrite the explorer and already conflict with main in autoform_cli/mathjax.py, autoform_cli/dag_viewer.py, tests/test_site_mathjax_node.py and tests/test_dag_viewer_browser.py, because of #455. This adds small hunks to the same files. Whichever lands second carries these fixes into the other's code.

Validation

jackmccarthy-77's review at 267445c1 (comment) found the site stylesheet naming the explorer, which test_render.py forbids; 28a48c80 moves that rule into the explorer's own style and the changelog line under Fixed. An adversarial review of 267445c1 found the same blocker, plus the card steps still rereading typeset output, which the changelog line claimed no pass did; 9e4a8c8a gives the card steps the same skip. Locally the render, site-math, rendering, Node MathJax, release and doc-budget suites pass. CI is running on 9e4a8c8a.

Removing either guard from the generated javascripts/mathjax.js passed every
test (#415). One test loads MathJax before the script, as a mkdocs.yml that
lists the bundle first does, and requires the guard's error and no formula
typeset, against a control run without the script that typesets both. The
other has the harness's MathJax report another release and requires the
version error and no pass.
… labels

From #455's final pass, each with a test that fails without it:
- The page input no longer processes a reference outside a formula, so a
  bare \ref in an explorer summary shows as typed rather than as ???;
  every article formula is delimited.
- A pass that adds to the page skips MathJax's output, so the hidden copy
  each formula keeps for assistive technology is not read again: a title
  whose \text held two \$ got a second, invisible formula there.
- The site's rule that clips a block holding a formula leaves the explorer
  alone. Its panels scroll, and the rule clipped the sides of the focus
  rings of rail and relation rows holding a formula.
- A distribution label is flex, so its text goes in a span of its own and a
  typeset "$K$-theory" stays one item.

The Node harness records the options the script asks of each document, so
the menu-free document for formulas in controls is checked there too, and the
tests pin that search rows, the head's trail and the handle with nothing
selected show titles as typed.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026
@Deicyde

Deicyde commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Review of #468 at 267445c: fix before merge. The four fixes work and each is pinned by a test. But the clip-rule change turns CI red.

Blocks merge

  1. test (3.13) fails on this PR's CSS change, and test (3.10) was cancelled with it. tests/test_render.py::test_the_site_stylesheet_leaves_the_explorer_to_its_own_rules asserts that the site stylesheet names no .bp-dag- class, because site rules for the explorer have broken it before. Its docstring names the landing map's scrolling. The new :not(.bp-readback *, .bp-dag-viewer *) (autoform_cli/render.py:4208) names one.
    • It fails locally too. The suites the description lists don't include tests/test_render.py.
    • Fix: keep the site rule as it was, and undo it in the explorer's own stylesheet for the lists only, for example .bp-dag-viewer.bp-dag-viewer :is(ul, ol):has(mjx-container) { overflow-x: visible; } in dag_viewer._STYLE.
      • The lists are what clipped the rows' focus rings. .bp-dag-navigation-summary needs to stay clipped, because its four-line clamp needs overflow: hidden (autoform_cli/dag_viewer.py:618).
      • The doubled class outranks the site rule, whichever order the two stylesheets load in.
      • I tried this. With the site rule restored and that rule added, tests/test_render.py, tests/test_site_math.py and tests/test_graph_view_rendering.py pass locally, 483 of 484 tests. The one failure is the selector pin this PR changed.
    • That pin, at tests/test_site_math.py:1598, then needs the old selector back. A pin for the explorer rule would go with the explorer's other CSS tests.

Note

Checked and fine

  • processRefs: false is set only in the page input (autoform_cli/mathjax.py:185); the startup input keeps its own. Articles don't change, since a \ref in their prose is never inside a formula element. With the setting removed, test_the_explorer_s_titles_and_summaries_are_typeset_as_articles_are fails.
  • skipHtmlTags. {"[+]": ["mjx-container"]} goes on both page documents, and each step gets its own copy. With it removed, the explorer test fails.
    • The card documents don't get it. I gave a card a formula whose assistive copy spells \(x\) across <mo> elements, and the explorer's pass found nothing in it, so I found no rereading there.
  • Guard tests. Removing the version check fails test_another_mathjax_release_leaves_every_formula_as_typed, and removing the early-load guard fails test_a_mathjax_listed_before_the_script_typesets_nothing.
  • Distribution label. The formula class moved to a span inside the flex label, so the swatch is no longer inside the formula element.
  • Runs. Locally, with the checked MathJax 3.2.2 tarball, the 9 Node tests and the 37 in tests/test_graph_view_rendering.py pass. In CI, the WebKit job and the MathJax Node job pass.

Posted by jackmccarthy-77.

The site stylesheet names nothing of the explorer's, as
test_the_site_stylesheet_leaves_the_explorer_to_its_own_rules checks, so the
site's rule that clips a block holding a formula is back as it was, and the
explorer's style lets its lists overflow sideways instead: its panels scroll,
and the clip cut the sides of its rows' focus rings. The summary keeps its
clipping, which its four-line clamp needs. The changelog line moves under
Fixed.

Reviewed by jackmccarthy-77.
The cards' steps had no skipHtmlTags, so a pass that added to a page read
each card's typeset formulas again, and a card formula whose text held TeX,
such as \text{see \begin{cases}a\end{cases}}, got a hidden formula typeset in
its assistive copy: the changelog line said no pass did that. The card steps
now share the page steps' skip. The Node test's explorer pass carries such a
card formula and checks that neither card finds anything.
@Deicyde

Deicyde commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Closed in favour of #471, at Jack's request: the fixes are tracked there and can land with, or after, the explorer rewrite in #442 and #444. The branch fix/explorer-math-followups (head 9e4a8c8) keeps the tested fixes and the merge-order session's MathJax guard tests, and jackmccarthy-77's review blocker is fixed on it.

@Deicyde Deicyde closed this Oct 25, 2026
@Deicyde

Deicyde commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Second round on #468 at 9e4a8c8: the blocker is fixed, and nothing blocks merge.

  • CSS. The site's clip rule is back to main's selector, so test_the_site_stylesheet_leaves_the_explorer_to_its_own_rules passes. The explorer's own stylesheet now unclips only its lists, with .bp-dag-viewer.bp-dag-viewer :is(ul, ol):has(mjx-container) { overflow-x: visible; }, pinned in tests/test_graph_view_rendering.py, and the summary keeps its four-line clamp. The tests/test_site_math.py selector pin is restored.
  • Card documents. My first round said I found no rereading in a card's typeset output. The author found a case that does reread: a card formula with \begin{cases} inside \text, whose assistive copy got a hidden formula. Card steps now take the page steps' skipHtmlTags while keeping their own classes. With the skip removed from the card steps, test_the_explorer_s_titles_and_summaries_are_typeset_as_articles_are fails, so the CHANGELOG line now holds for cards too.
  • CHANGELOG. The entry now sits under "Fixed".
  • Runs. All 9 checks pass at 9e4a8c8. Locally, with the checked MathJax 3.2.2 tarball, the 9 Node tests, the 37 rendering tests and the two CSS tests pass.

Posted by jackmccarthy-77.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant