Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed MathJax code being displayed twice by dsMarkdown pipe #2397

Conversation

alexandrevryghem
Copy link
Member

References

Description

Fixed MathJax code being displayed twice, this is because a HTML tag mjx-assistive-mml is created for screen readers to be able to read the MathJax code. Because the dsMarkdown pipe sanitises the HTML it transformed this hidden HTML tag to text instead leading to the MathJax code being displayed twice.

Instructions for Reviewers

List of changes in this PR:

  • Added the mjx-assistive-mml HTML tag (and it's child HTML tags) to the sanitizeHtml's allowedTags to ensure it won't be turned into text

Guidance for how to test/review this PR:

  • Create a new item with the following content in dc.description.abstract:
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam rutrum mi ligula, eget luctus diam ultricies vitae ${\ell}$. Quisque elit libero, eleifend eu pretium a, gravida at felis. Proin sed imperdiet nibh. Integer sit amet eleifend ligula. Maecenas semper vestibulum lorem. Mauris ut tortor diam ${\color{Red}2\ell\geq\binom{d}{\lfloor\frac{d}{2} \rfloor}}$. Sed elementum erat dolor, id rhoncus augue dignissim et. Curabitur a ligula vestibulum sapien maximus ultricies dignissim at leo ${\color{Red}\textit{L}_T}$. Mauris vulputate magna at turpis eleifend, sit amet lacinia tellus malesuada. Nam nisi ex, ultrices sed posuere at, laoreet vel ligula. Aenean scelerisque in lacus sed tristique ${\color{Red}\mathcal{O}\left(\textit{L}_T\text{ log}\left(\textit{L}_T\ell \right) \right)}$. Pellentesque rhoncus viverra metus vitae scelerisque. Aliquam iaculis commodo erat, tincidunt auctor augue tincidunt sit amet. Suspendisse placerat velit ut magna vulputate semper. Praesent non aliquet tortor.
    
  • Check that the MathJax code is only displayed once

Checklist

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

This was due to sanitizeHtml rendering the mjx-assistive-mml tag as text. This tag is used by screen readers and therefor we should allow it to be rendered
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @alexandrevryghem ! Tested this locally and verified it fixes the bug. Code looks good too

@tdonohue tdonohue merged commit 0fca4e0 into DSpace:main Aug 3, 2023
17 checks passed
@alexandrevryghem alexandrevryghem deleted the fix-mathjax-displaying-twiced-in-ui_contribute-main branch August 3, 2023 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug medium priority usability ux User Experience related works
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Mathjax code is displayed twice in the UI
2 participants