Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text replacement via user selection in inline code block causes entire paragraph to be lost along with focus #3450

Closed
sufian-slack opened this issue Sep 17, 2021 · 4 comments

Comments

@sufian-slack
Copy link

Steps for Reproduction

  1. Visit https://jsfiddle.net/yoa5hp91/
  2. Using the keyboard (shift + arrow keys) or the mouse, make a text selection starting from the beginning of the inline code to the end of the inline code plus the following space character. i.e. if you were to look at the plain text copied as a string, you would see "inline code ".
  3. Press any letter (like a) on the keyboard to replace the selected text with the letter you have typed

Expected behavior:

I would expect the selected text to be replaced with the letter pressed on the keyboard, with either the text to keep the formatting of the inline code block, or have the formatting of the surrounding text.

Actual behavior:

The entire second paragraph is lost from the DOM and focus is lost. Attempting to undo this action (ctrl-Z or cmd-Z) will cause only a portion of the text to be restored.

Here's a screen capture showing selection via mouse, keypresses, and the undo behavior (on a Mac, using Chrome 93)
repro

Platforms:

Tested on on:

  • FAIL - MacOS Big Sur 11.6 - Chrome: Version 93.0.4577.82 (Official Build) (x86_64)
  • FAIL - MacOS Big Sur 11.6 - Safari: Version 14.1.2 (16611.3.10.1.6)
  • PASS - MacOS Big Sur 11.6 - Firefox: 92.0 (64-bit)
  • FAIL - Windows 10 - Chrome: Version 93.0.4577.82 (Official Build) (64-bit)
  • FAIL - Windows 10 - Edge: Version 93.0.961.52 (Official build) (64-bit)
  • PASS - Windows 10 - Firefox: 92.0 (64-bit)

Firefox works as expected on both Windows and MacOS (the replaced text is formatted as an inline code block)

Version:

Quill version: 1.3.6

Also verified bug still remains on 2.0.0-dev.0 on Chrome.

@darbentov
Copy link

+1

@darbentov
Copy link

@sufian-slack Did you find a solution for that? I'm facing a similar issue #3522

@sufian-slack
Copy link
Author

Unfortunately no, haven't spent the time on this. If you happen to come across a fix please let me know!

@luin
Copy link
Member

luin commented Jun 23, 2023

Fixed in #3807. Feel free to let me know if there is anything missing. Closing

@luin luin closed this as completed Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants