Skip to content

[BUG] Tooltip does not work when CSP is set to style-src: 'self' #1059

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

Closed
zachary-woodridge opened this issue Jul 12, 2023 · 2 comments
Closed
Labels

Comments

@zachary-woodridge
Copy link

zachary-woodridge commented Jul 12, 2023

Bug Description
When I run a local development server the tooltip appears fine, but when I deploy to my server that has a Content Security Policy set to style-src: 'self' and load my webpage I get a bunch of errors in console that point to the react-tooltip files. The html element will appear and disappear from the DOM on hover but nothing will display.

Version of Package
v5.18.0

Expected Behavior
The style is included without being injected inline and the tooltip can render

Screenshots
error
error2

@danielbarion
Copy link
Member

danielbarion commented Jul 12, 2023

@zachary-woodridge can you please try disabling the style injection: https://react-tooltip.com/docs/examples/styling#disabling-reacttooltip-css

and try importing the CSS file like previous versions: https://github.com/ReactTooltip/react-tooltip#usage

And let us know about the result, thanks!

@zachary-woodridge
Copy link
Author

This solved my issue, thanks a bunch! I wish I had known to look at that part of the docs earlier.
Style Injection
unsafe inline

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

No branches or pull requests

2 participants