testing-library / testing-library/user-event
Manipulating `ClipboardEvent.clipboardData`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Description
@testing-library/user-eventversion:v14.0.0-beta.11
Relevant code or config
document.addEventListener('copy', e => e.clipboardData.setData('text', 'bar'))
document.addEventListener('cut', e => e.clipboardData.setData('text', 'bar'))
document.addEventListener('paste', e => e.clipboardData.setData('text', 'bar'))
Problem description:
When double-checking #862 and #866 , I discovered that accessing/manipulating ClipboardEvent.clipboardData is limited.
(In Firefox:)
The data written to Clipboard is independent from the clipboardData on the cut/copy event. Manipulating has no effect.
Also the handler cannot read the clipboard data.
The data pasted from Clipboard is readable on the paste event. But manipulating it results in a DOMException.
Suggested solution:
Check consistency across browsers. If it is, implement API accordingly.
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
The issue provides no file or test path. Start by reproducing the copy, cut, and paste handlers in the relevant browser environments and comparing clipboardData behavior; done means the supported behavior is consistent across browsers and covered by regression tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100