testing-library / testing-playground

Simple and complete DOM testing playground that encourage good testing practices.
https://testing-playground.com
MIT License
788 stars 62 forks source link

Cursor jumps to the very beginning of the editor on pasting a copied string #297

Closed vasilii-kovalev closed 3 years ago

vasilii-kovalev commented 3 years ago

Bug Report 🐛

Cursor jumps to the very beginning of the editor on pasting a copied string.

Before pasting: image After pasting: image

Reproduced both in markup and query editors.

To Reproduce ✔️

  1. Copy any string from somewhere
  2. Go to the site
  3. Paste the string to markup or query editor via Ctrl + V or context menu.

Expected behavior 🤔

Cursor is placed right after the last pasted character

Suggested solution 🔦

Maybe it can help: https://egghead.io/lessons/react-preserve-cursor-position-when-filtering-out-characters-from-a-react-input

Your Environment 💻

vasilii-kovalev commented 3 years ago

P.S.: It seems the link from the bug report template (https://develop.testing-playground.com/) doesn't work. image

smeijer commented 3 years ago

Thanks for the report @vasilii-kovalev. Both issues should now have been fixed.