-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Nested marker highlight breaks mouse text selection #9513
Comments
In the past, we were hoping to stop rendering while the selection is being made. This would solve a range of problems when we change the DOM (e.g. when you start selecting from the end of a link). |
The second option is to work on this specific case only – to make sure that converting markers applies fewer changes to the tree. |
After debugging the issue - there were 2 problems:
|
After further debugging and PoCing:
Case 1 is already addressed by avoiding updating the DOM selection if it's in the desired position (it sometimes is violated by Cases 3 and 4 can be easily fixed, but case 2 is difficult to fix. There are some ideas:
from: <span data-comment="thread-1">
123
<span data-comment="thread-2">
456
</span>
789
</span> to: <span data-comment="thread-1">
123
</span>
<span data-comment="thread-1,thread-2">
456
</span>
<span data-comment="thread-1">
789
</span> so the active marker (with higher priority won't change the DOM structure (only update the style classes). |
📝 Provide detailed reproduction steps (if any)
✔️ Expected result
Selection is not collapsed and where the mouse button was pressed and ends where it was released.
❌ Actual result
Selection is collapsed at the end of the expected selection range.
What I discovered while debugging it:
selectionchange
DOM event is not providing a proper range, it's already collapsed at this pointWhile with caret outside the marker looks like this:
I suppose that the problem might be caused by the replacement of the DOM nodes on the first selection change that causes this issue (the original node is removed and replaced with other nodes).
📃 Other details
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: