FormidableLabs / FormidableLabs/react-live

Pasting a new line causes incorrect cursor movement

Open
#409 3 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
4.6k
Forks
260
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

### Code Sandbox link

_No response_

### Bug report

Hi,

There is a strange behavior in the current 4.18.0 version. It is easily reproducible on the docs [website](https://commerce.nearform.com/open-source/react-live):

1. Copy a piece of code with a new line in it
2. Paste it somewhere in the editor several times in a row
3. See the cursor moves forward and breaks the code eventually

https://github.com/user-attachments/assets/8acc39af-7a63-4dea-9310-34d0774cf8f7

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue on the linked React Live docs website by repeatedly pasting code containing a newline. Trace the editor's paste and cursor-position handling, then verify that repeated multiline pastes leave the cursor in the correct position and do not corrupt the code.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.