Skip to content

Issue with the LiveEditor and carriage returns #308

Closed

Description

@elchininet

I installed the new version 3.0.0 and there is an issue with LiveEditor. To reproduce the issue, it is easier if you go directly to the demo and follow these steps:

  1. Go to the Or just some JSX code! section
  2. Place the caret at the end of the code (after the last > of the h3)
  3. Try to create a new line hitting on Return
  4. A new line is created
  5. Try to remove that change with backspace key
  6. The carriage goes back but the new line is not deleted
  7. Try to delete the new line using the delete key
  8. The new line is deleted but also the parentheses is moved
  9. Try to reverse this change hitting return
  10. The parentheses goes to the new line but indented
  11. Try to remove the indentation with backspace
  12. The carriage returns to the above line

It is very hard to write code with this behaviour. Just try to code for some time in a LiveEditor of the current demo and you will notice the really bad experience.

Activity

  1. elchininet commented on Mar 24, 2022

    @elchininet
    Author

    I did a quick test and reverting the introduction of use-editable in the Editor file solves this issue.

  2. mryechkin commented on May 24, 2022

    @mryechkin

    Seeing this issue as well, and it's incredibly annoying for an end-user. Doesn't make for a nice experience while trying to type in some code

  3. elchininet commented on Jun 3, 2022

    @elchininet
    Author

    As I've isolated this issue to use-editable, this issue there seems to be related:

    FormidableLabs/use-editable#17

  4. greypants commented on Sep 27, 2022

    @greypants

    I noticed this as well. Here's a gif showing the bug:

    bug

  5. stefcameron commented on Mar 6, 2023

    @stefcameron

    I'm seeing similar behavior. It's very annoying. Didn't used to be like this. Debouncing the update to the LiveProvider's code prop helps a bit, but it doesn't solve the issue. Whenever the update finally gets applied to state, the cursor can sometimes (but frequently enough) get bumped a character or two, especially if the user had stopped typing is now moving the cursor around with the arrow keys (so the debounced function executes, code state updates, LiveEditor updates and problems ensue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions