testing-library / testing-library/user-event

Manipulating `ClipboardEvent.clipboardData`

Open
#867 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accuracy
Dominant language
TypeScript
Stars
2.3k
Forks
258
PR merge metrics
No merged PRs in 30d

Description

  • @testing-library/user-event version: 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.