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

Can't annotate https://community.canvaslms.com/ (issue with tsParticles) #6210

Open
robertknight opened this issue Feb 14, 2024 · 2 comments

Comments

@robertknight
Copy link
Member

Steps to reproduce:

  1. Activate the Hypothesis browser extension on https://community.canvaslms.com/t5/Canvas-Studio-Blog/Connecting-Studio-OAuth-via-Postman/ba-p/259739
  2. Select text

Expected: Annotate/Highlight toolbar appears
Actual: Toolbar does not appear. Browser console shows an error:

html.ts:135 Uncaught TypeError: n.setStart is not a function
    at Bn.toRange (text-range.ts:292:11)
    at Bn.trimmedRange (text-range.ts:325:49)
    at Zi.getAnnotatableRange (html.ts:130:24)
    at dr._onSelection (guest.ts:818:48)
    at guest.ts:289:14
    at selection-observer.ts:30:9

On this page the Range global has been overwritten with a different object which doesn't have the expected API. The problem is caused by the script https://cdn.jsdelivr.net/npm/tsparticles-confetti@2.9.3/tsparticles.confetti.bundle.min.js. Using Chrome devtools to block this script when the page loads prevents the problem from occurring. The issue also occurs on the home page of the tsParticles library - https://particles.js.org.

@robertknight
Copy link
Member Author

I filed an upstream issue to see if the tsParticles library can avoid overwriting the DOM Range object. In the meantime we might need to use some technique other than new Range to construct ranges to prevent this. Enforcing this would require a lint check. We have a similar existing issue with sites that have broken URL polyfills on them.

@robertknight
Copy link
Member Author

The issue in tsParticles was fixed upstream in the v3.2.2 release, so this means we just need to deal with sites that still reference older versions. https://community.canvaslms.com for example is loading https://cdn.jsdelivr.net/npm/tsparticles-confetti@2.9.3/tsparticles.confetti.bundle.min.js at the time of writing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant