yishn / tikzcd-editor

A simple visual editor for creating commutative diagrams.
https://tikzcd.yichuanshen.de/
MIT License
1.86k stars 100 forks source link

Page goes blank after keydown on first load #48

Closed cemulate closed 3 years ago

cemulate commented 4 years ago

I know this sounds weird but...

Upon performing a hard reload of the site, one can click in any cell, and as soon as any key is pressed, the entire page goes white. The "reason" is clear: the inspector shows that div#root has display: none on it. Upon reloading the page, this doesn't happen anymore!

However, upon hard reloading the page, the issue happens again, and can only be fixed with a (regular) reload.

I've managed to produce this in Chrome and Firefox.

cemulate commented 4 years ago

This isn't going to be very useful but I have determined a few things. Unfortunately I can't reproduce it locally. However from poking around on the live site it appears to be a MathJax issue. In particular, on the first keydown event in a grid cell MathJax fires up and tries to load a font. For some reason, this fails only in the conditions described above and MathJax is trying to set/clear its error message, and somehow sets the entire div.root to display: none instead of... whatever div its error message is supposed to live in (maybe this has to do with turning errors off in MathJax?).

Seems likely that it's a MathJax bug. Currently the app is loading 2.7.6, and there don't appear to be any releases past that before 3, and migrating to 3 would be a moderately substantial task given the high use of the MathJax API.

yishn commented 4 years ago

Just for information, in case someone wants to pick this up: I believe the only place that uses MathJax substantially is GridCell and GridArrow for typesetting the labels and integrating into the Preact framework.