Rich text: avoid updating partial selection unnecessarily#44330
Merged
Rich text: avoid updating partial selection unnecessarily#44330
Conversation
|
Size Change: +114 B (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
Contributor
|
Nice, fast work, that does fix the flicker for lists: However it reintroduces an older issue we had where when hovering between paragraphs it goes into "full selection" rather than partial selection: This could be because I'm not testing this PR correctly, I just tried it out and used |
Member
Author
|
I'll need to add some inline comments, cause it's getting a bit unclear what is happening. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What?
This should fix the flicker in #44150 (comment).
Why?
Who likes flicker?
How?
The problem is that in the selection observer, we detect that the selection start is e.g. the paragraph block, and the selection end is in e.g. a list item, so it resets the depth of the selection end to the list block instead of the list item so that the list block is fully selected.
However, rich text will just ignore this, detect some selection end in the list item, and set the selection end offset together with the new client ID of the list item. So the solution is to check if the client ID to update is the same as one we have in the store, otherwise just ignore what rich text is detecting.
Testing Instructions
Screenshots or screencast