Phenomenon
When a page has a strict Content Security Policy (CSP), certain contenteditable operations may be restricted. Pasting content, executing scripts, or inserting HTML may be blocked depending on the CSP directives.
Reproduction example
- Create a page with a strict CSP header (e.g.,
default-src 'self'). - Create a contenteditable div on the page.
- Try to paste content from clipboard.
- Try to insert HTML programmatically.
- Observe any CSP violations or blocked operations.
Observed behavior
- In Chrome on Windows, CSP may block certain contenteditable operations.
- Pasting may be restricted if
unsafe-inlineis not allowed. - Script execution within contenteditable may be blocked.
- CSP violations may be logged in the console.
Expected behavior
- CSP should not interfere with basic contenteditable editing.
- Pasting should work within CSP constraints.
- Or, there should be clear documentation on CSP and contenteditable interaction.