Support navigator.clipboard inside of Service Workers
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 202
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
Hiya folks,
I work in devrel for Chrome Extensions. I have been helping folks migrate to manifest v3, and one thing that has come up a number of times in clipboard access. In the past, a background page made it easy to use standard DOM interactions with the clipboard. But with extensions moving to a service worker based background in manifest v3, it becomes a lot more complicated. While there are workarounds¹, it would greatly reduce complexity of a number of extensions if the platform had access to navigator.clipboard.
In practice, I believe this would mean exposing Clipboard onto WorkerNavigator, as that is what is inherited by the service worker.
1. Here is a code example. We havechrome.offscreen, which gives the developer access to a HTML document they provide that is rendered offscreen. To copy the clipboard, you need to create the offscreenDocument singleton, send an event over RPC to the HTML document they provide, which listens for the event, then executes document.execCommand (offscreen documents don't support navigator.clipboard as of now), then responds with another RPC back to the service worker with the data they requested, and then shut down the offscreenDocument. Its a lot of indirection.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Clipboard API section linked in the issue and the HTML specification's WorkerNavigator entry point. Trace how navigator.clipboard is exposed today, then document the required specification changes and confirm that the proposed WorkerNavigator exposure is agreed and complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100