pretext icon indicating copy to clipboard operation
pretext copied to clipboard

Updated knowl.js for MathJax compatibility of hidden content

Open geoff-cox opened this issue 1 year ago • 4 comments

The following PR is based on the suggestions provided by MathJax.

Removed line 315, which previously called MathJax.typesetPromise() before the knowl's visibility was updated. MathJax could not accurately measure the dimensions of elements while they were still hidden (display: none).

Updated line 60 to delay the call to MathJax.typesetPromise() until after the knowl becomes visible, but before the unrolling animation begins. This ensures that MathJax has the correct layout context for typesetting, preventing layout shifts and improving the smoothness of the animation.

I verified that knowls containing mathematical content is rendered correctly without layout shifts and ensured that the unrolling animation remains smooth and that no visual glitches occur during the transition.

geoff-cox avatar Aug 12 '24 14:08 geoff-cox

Thanks, @geoff-cox! I was just going to catch-up and encourage you to do this.

I'll try to take it for a spin, but input from @davidfarmer and @bnmnetp would be very helpful.

rbeezer avatar Aug 12 '24 14:08 rbeezer

Took this for a drive and it looks good. Cross-reference knowls with math seem fine. Turned on lots of born-hidden knowls for the sample article and things like a Parsons problem with math inside a born-hidden knowl seem to be fine as well. Would like to have @davidfarmer check-off before merging.

rbeezer avatar Aug 12 '24 15:08 rbeezer

Pinging @davidfarmer and @bnmnetp for input or check-off. Thanks.

rbeezer avatar Sep 20 '24 17:09 rbeezer

Looks okay. Sorry it took so long.

davidfarmer avatar Sep 20 '24 18:09 davidfarmer

Merged, with code as-is. Consolidated to a single commit with a one-line commit message.

Thanks for fixing this up - seems to be working great. Sorry for the delay, this one needed extra review (which I lost track of).

rbeezer avatar Mar 14 '25 23:03 rbeezer