Opened 11 years ago
Last modified 11 years ago
#10438 closed Bug
[FF&IE] No selection put in editable on setData — at Version 10
Reported by: | Piotrek Koszuliński | Owned by: | Piotrek Koszuliński |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.2 |
Component: | Core : Selection | Version: | |
Keywords: | Cc: |
Description (last modified by )
Attached two samples.
TC:
- Open framed_focus.html sample.
- Open console.
- Execute
setData();
. - Quickly focus editor and wait.
- After data will be set verify:
- Whether caret blinks.
- Whether
EDITOR#BLUR
is logged when you click outside editor. - Whether you can type and whether after typing additional paragraph is not created (what means that selection was placed outside editable place.
Note: selection issues (3rd point) in inline editor are not a subject of this ticket. The most important part is fixing blur problem (2nd point), selection in framed editor is fixed because it was convenient.
Change History (12)
comment:1 Changed 11 years ago by
Status: | new → confirmed |
---|
comment:2 Changed 11 years ago by
Owner: | set to Piotrek Koszuliński |
---|---|
Status: | confirmed → assigned |
comment:3 Changed 11 years ago by
Description: | modified (diff) |
---|---|
Summary: | [FF] No selection put in editable on setData → [FF&IE] No selection put in editable on setData |
Changed 11 years ago by
Attachment: | framed_focus.html added |
---|
Changed 11 years ago by
Attachment: | inline_focus.html added |
---|
comment:4 Changed 11 years ago by
comment:5 Changed 11 years ago by
There will be another advantage of promoting this fix higher. We will be able to make the initial caret location configurable and I have seen such requests.
Although, since we are short on time, we may work on extracting this patch later, because that would require some research and tests.
comment:7 Changed 11 years ago by
I pushed few more commits to tests and dev making all browsers pass them.
- IE7/8 - very similar fix to that for IE9.
- Opera - it says: 'everything is fine, really! selection and active element are fine!'... yeah - right. I haven't found a way to discover that selection is broken, so I just added tests to ignored.
comment:8 Changed 11 years ago by
It turns out that we have to improve this patch and use for all setData
calls (also initial one) earlier than I thought. As #10439 proves, we need to have consistent initial selection (before first focus, after focus&setData, after switching from source mode and in all other cases) in all browsers.
In cases when we do not need selection locking (FF and Chrome with framed editor) it will be as simple as it is now - on editor load we need to set selection in the right place (range.moveToElementEditStart( this.root, true/false )
). In other cases I think that we can mock initial locked selection, as the editor was focused before. Although... brace yourself - critical core changes are coming.
comment:9 Changed 11 years ago by
Status: | assigned → review |
---|
I pushed simplified version of t/10438.
Tests:
- FF latest - 100%
- Chrome - 100%
- FF 3.6 - regression: http://ckeditor4.t/dt/core/selection/editor.html - "test selection on initial focus - ensure new doc" - but do we support 3.6?
- IE9 - 100%
- IE8 - 100% but I got alert
'Stack overflow at line: 0'
in http://ckeditor4.t/dt/core/htmldataprocessor.html which... does not test selection at all. Although, it loads data, so perhaps this is it. I'll debug this if you can confirm alert.
Note: Tests created for this ticket contains some events logging - I left this intentionally - they help while testing.
comment:10 Changed 11 years ago by
Description: | modified (diff) |
---|
Pushed t/10438 on tests and t/10438 on dev with prototype of a patch.
Tests are fixed on FF and IE9 and they pass on Webkit on master. I haven't yet tested whether IE8, IE10 and Opera also require this fix.
Manual tests on framed_focus.html also pass.
Manual tests on inline_focus.html does not fully pass - selection is not placed in editable place on FF and IE (Chrome is ok). On IE9 additionally, selection is placed at the end of editable, not at the beginning.
This makes me thing that perhaps we should promote these fixes to some editor's method called on every setData. Perhaps the original fix for Webkit also does not have to be in selection construtor. I've found that it was proposed for these issues: