-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
typed.js cursor animation issue using strict Content Security Policy for style-src #592
Comments
Interesting. To get the blinking animation, you could copy the CSS from here and insert it into your project manually. I'll have to figure out how to provide the CSS some other way without injecting a style tag. Lines 171 to 188 in f0759c1
|
thanks for your reply, @mattboldt the suggested workaround of placing the typed cursor CSS code in an external style sheet works fine. i also tried adding a nonce attribute to the style tag and the CSP. the style tag that is appended to the HTML by typed.js needs a nonce attribute and value that corresponds to that of the nonce in the CSP. this way the style tag will be rendered and the cursor will blink even with unsafe-inline removed for style src inside the policy. this can be done manually in HTML or inside the js itself. generating and using a hash for the code:
should be fine also |
Would love this to be resolved or have a documented solution (without custom hacks and using npm package) 🙏 |
Honestly I think the best solution for now is to pass the In a new version, I'm gonna consider removing the auto generated css entirely, and include a CDN link to the css in the docs, but I'll also include the raw css you can copy and paste and customize if you like. This way the JS code doesn't make any assumptions about your setup or inject unexpected tags into your html. |
Thank you @mattboldt we missed the |
fantastic!
thank you @mattboldt |
Description
Greetings!
Unless my web server is configured with a CSP using style-src 'unsafe-inline', the cursor does not blink.
Apologies if this is not an actual issue pertaining to typed.js, but i'm looking for a workaround. Any suggestions?
I think this has to do with the style attribute that is changed/appended by type.js
Is there a way to add a nonce in typed.js file or elsewhere somehow or any other obvious workaround I am missing?
Many thanks and regards!
Steps to Reproduce
Expected behavior:
Typed cursor should blink.
Actual behavior:
Reproduces how often:
100%
The text was updated successfully, but these errors were encountered: