product-backlog icon indicating copy to clipboard operation
product-backlog copied to clipboard

Unable to select MathJax math expressions for highlighting or annotation

Open chrisdaaz opened this issue 2 years ago • 1 comments

Bug report form

Steps to reproduce

  1. Open an assignment (Demo Canvas module, Page 8 has some in-line math) or visit a page (Demo Public URL) with mathematical expressions rendered by MathJax
  2. Try to create a highlight or annotation of a mathematical expression

Expected behaviour

The user should be able to select the math notation for annotation.

Actual behaviour

For in-line math, users can select the surrounding text to make an annotation, but users who wish to select display math (i.e. block div elements), the client provides no method for annotating just the math.

The text selector skips over the text wrapped in $ or $$ delimiters, elements that contain the raw LaTeX code:

Example block element:

<html>
<body>
<!--StartFragment-->

<div>
$$
\begin{aligned}
\mathbf{x} = \mathbf{z}_K &= f_K \circ f_{K-1} \circ \dots \circ f_1 (\mathbf{z}_0) \\
\log p(\mathbf{x}) = \log \pi_K(\mathbf{z}_K)
&= \log \pi_{K-1}(\mathbf{z}_{K-1}) - \log\left\vert\det\dfrac{d f_K}{d \mathbf{z}_{K-1}}\right\vert \\
&= \log \pi_{K-2}(\mathbf{z}_{K-2}) - \log\left\vert\det\dfrac{d f_{K-1}}{d\mathbf{z}_{K-2}}\right\vert - \log\left\vert\det\dfrac{d f_K}{d\mathbf{z}_{K-1}}\right\vert \\
&= \dots \\
&= \log \pi_0(\mathbf{z}_0) - \sum_{i=1}^K \log\left\vert\det\dfrac{d f_i}{d\mathbf{z}_{i-1}}\right\vert
\end{aligned}
$$
</div>

<!--EndFragment-->
</body>
</html>

Example in-line element:

<p>(*) A note on <em>&ldquo;Jacobians of invertible function&rdquo;</em>: The determinant of the inverse of an invertible matrix is the inverse of the determinant: $\det(M^{-1}) = (\det(M))^{-1}$, <a href="#jacobian-matrix-and-determinant">because</a> $\det(M)\det(M^{-1}) = \det(M \cdot M^{-1}) = \det(I) = 1$.</p>

Browser/system information

  • Microsoft Edge / Windows 11
  • Canvas LMS / Via
  • Firefox / Windows 11

Additional details

This is an update to https://github.com/hypothesis/product-backlog/issues/918

chrisdaaz avatar Dec 02 '22 20:12 chrisdaaz

Another user has brought this issue up: https://app.hubspot.com/contacts/6291320/ticket/1642649879

mattdricker avatar May 24 '23 19:05 mattdricker