-
Notifications
You must be signed in to change notification settings - Fork 40
DOM selection change will not be converted if the selection was placed outside of the editable element #1814
Conversation
…placed outside of the editable element.
Tests don't pass. |
Weird. Works for me locally on FF v. 72.0.2:
|
Okay, the build passed. FF was throwing error when changing selection to a non-focused div. But I had to focus the browser window first to even see it failing. |
This change definitely requires a lot of manual testing of various scenarios. Could you write down some things that you think that we should have checked? |
The purpose of this PR is to have the selection not change when you click outside the editor editable element. This is the main thing to test. For example, if the first element is a heading, put a selection in the paragraph, click outside of the editor and then check if the value in heading dropdown changed. Check it in normal mode and in read-only mode. Other than that, this change is a little difficult to test, because the model selection is invisible when you blur the editable. You can use CKE5 Inspector to help you with that. Put selection in the editor, then blur it (you can use Tab to have another use case) and then click around. |
This PR is ready for review and was tested on Cloud Features side. |
I asked @Mgsy to think about what needs to be tested here (various cases, features with UI, different browsers, etc.) and check those things. I've got to say – I'm quite afraid of this change :D |
We've tested it in different browsers and besides issues reported by @FilipTokarski, those changes look fine. |
I don't know if this is something we consider really bad. It is true, that on FF you can make selection by "dragging" the mouse next to the editor. But, I guess, this is not our fault that FF sets the selection there? IDK. @Reinmar? If I had to guess, I'd say that it won't cause any bugs. This will be difficult / impossible to fix if we will use the solution I implemented. Unfortunately, when you click inside the selection, the selection is removed from the document (I mean DOM document). This is why it is not changed in the editor. After the second click, the DOM selection is set again. |
It's an interesting finding. I recall this issue from a looong time ago :D But it indeed shouldn't be a big deal.
I'd say that it's not a big deal as well. The read only mode is not something you normally operate in. Additionally, those kind of issues are natural to self-correct by the user. You don't see the editor reacting to your action, you try 2nd time, perhaps differently. Thanks @FilipTokarski @Mgsy @scofalik for all your input. I'll read the code again and merge this PR. |
Suggested merge commit message (convention)
Fix: DOM selection change will not be converted if the selection was placed outside of the editable element. Closes ckeditor/ckeditor5#4199.