testing-library / testing-library/user-event

copy/paste HTML elements into contenteditable

Open
#1,193 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Reproduction example

https://codesandbox.io/p/sandbox/clever-shockley-lkdm23?file=%2Fsrc%2FApp.js%3A10%2C34

Prerequisites

1、Renders a div whose contentEditable is true
2、Using keyboard, simulate the user to copy a Heading elements

Expected behavior

The style of theHeading elements is retained

Actual behavior

Heading elements are escaped
image

User-event version

14.5.2

Environment

@testing-library/react@^13.4.0
@testing-library/jest-dom@^5.17.0

Additional context

No response

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

Start by running the linked CodeSandbox reproduction with user-event 14.5.2 and inspect how keyboard copy handles a contentEditable div containing a heading. Confirm that the copied heading retains its style rather than being escaped, then add regression coverage for the reported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.