Phenomenon
When using the Clipboard API (navigator.clipboard.readText() or navigator.clipboard.read()) to programmatically paste content into a contenteditable region, the paste operation may fail or not work as expected.
Reproduction example
- Create a contenteditable div.
- Copy some text to the clipboard.
- Use JavaScript to read from clipboard:
await navigator.clipboard.readText(). - Try to insert the text into the contenteditable.
- Observe whether the paste works correctly.
Observed behavior
- In Chrome on macOS, Clipboard API operations may fail in contenteditable contexts.
- Permission errors may occur.
- The paste may not trigger expected events or behaviors.
Expected behavior
- Clipboard API should work reliably in contenteditable contexts.
- Permissions should be handled correctly.
- Paste operations should trigger appropriate events.