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

[FF] Error after moving focus to the image caption using Tab #676

Closed
Mgsy opened this issue Nov 20, 2017 · 8 comments Β· Fixed by ckeditor/ckeditor5-engine#1201
Closed

[FF] Error after moving focus to the image caption using Tab #676

Mgsy opened this issue Nov 20, 2017 · 8 comments Β· Fixed by ckeditor/ckeditor5-engine#1201
Assignees
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@Mgsy
Copy link
Member

Mgsy commented Nov 20, 2017

🐞 Is this a bug report or feature request? (choose one)

  • Bug report

πŸ’» Version of CKEditor

1.0.0-alpha2

πŸ“‹ Steps to reproduce

  1. Go to http://localhost:8125/ckeditor5-core/tests/manual/article.html.
  2. Put the caret at Heading 1.
  3. Press Tab

βœ… Expected result

Focus should move to the caption without error.

❎ Actual result

Focus moves to the caption and there is the error in the console.

πŸ“ƒ Other details that might be useful

Error

NS_ERROR_FAILURE: renderer.js:623
_updateDomSelection renderer.js:623
_updateSelection renderer.js:558
render renderer.js:235
render document.js:277
decorate/< observablemixin.js:327
fire emittermixin.js:273
decorate/this[methodName] observablemixin.js:331
FocusObserver/</this._renderTimeoutId<

GIF
bug_cke5

Browser: Firefox 57 (Quantum).

Note: I'm able to reproduce this issue also in Firefox 56.

@Mgsy Mgsy added package:engine type:bug This issue reports a buggy (incorrect) behavior. labels Nov 20, 2017
@Mgsy Mgsy added this to the iteration 14 milestone Nov 20, 2017
@ma2ciek ma2ciek self-assigned this Dec 4, 2017
@ma2ciek
Copy link
Contributor

ma2ciek commented Dec 4, 2017

I've checked it on Chome and Firefox@59 and listed below some results.

NS ERROR FAILURE it's a very generic Firefox error, it's hard to tell what actually goes wrong under the hood.

I see, that in the _domSelectionNeedsUpdate on FF, oldViewSelection is updated to the figcaption, but this.selection is not, so the Renderer tries later to move the selection to the place where the selection was before.

In Chrome, both this.selection and oldViewSelection were the same and pointing the Caption, so the Renderer didn't have to change it.

The _domSelectionNeedsUpdate is here:
https://github.com/ckeditor/ckeditor5-engine/blob/53ad06c8ea364a8ee940d5b2b8f9e74ee6d99a8b/src/view/renderer.js#L634-L654

I'll check whether this is not a problem with view selection.

It actually works with a try-catch block, so it should be just a case of not set Selection.

@ma2ciek ma2ciek closed this as completed Dec 4, 2017
@ma2ciek ma2ciek reopened this Dec 4, 2017
@ma2ciek
Copy link
Contributor

ma2ciek commented Dec 4, 2017

Differences between Chrome and FF.

Note: the first rendering is because of the manually placed cursor at the beginning.

Chrome ViewSelection changes and rendering:

screen shot 2017-12-04 at 16 18 02

FF ViewSelection changes and rendering:

screen shot 2017-12-04 at 16 17 40

@ma2ciek
Copy link
Contributor

ma2ciek commented Dec 4, 2017

I see that shift + tab from the caption doesn't work at all in the latest FF.

@ma2ciek
Copy link
Contributor

ma2ciek commented Dec 5, 2017

It looks like the selection:change event is fired several milliseconds after the focus:change event on the FF and that implies wrong command execution order.

FF:
screen shot 2017-12-05 at 14 37 12

Chrome:
screen shot 2017-12-05 at 14 37 30

It looks like we can increase the timeout in the: https://github.com/ckeditor/ckeditor5-engine/blob/7755349c190f08e3806ae562f094823c5db57088/src/view/observer/focusobserver.js#L38 to solve that issue as we can't ensure correct order in a different way.

@ma2ciek
Copy link
Contributor

ma2ciek commented Dec 5, 2017

@Reinmar
Copy link
Member

Reinmar commented Dec 5, 2017

Can't we make the code more bulletproof? Selection changes should not depend on focus changes and vice versa.

We could, of course, increase the timeout but it's hard to tell to what value. At some point the delay in which the editor reacts will be noticable but the editor might be still unstable in some specific cases on overloaded and slow devices.

@ma2ciek
Copy link
Contributor

ma2ciek commented Dec 5, 2017

Can't we make the code more bulletproof? Selection changes should not depend on focus changes and vice versa.

Sure, I'll talk with @szymonkups about other possibilities. But I guess, it's not gonna be easy.

@ma2ciek
Copy link
Contributor

ma2ciek commented Dec 11, 2017

After a F2F talks, we agreed that using longer setTimeout is ok for now as a quick bugfix, this will solve https://github.com/ckeditor/ckeditor5-engine/issues/1157 too. And then we should start working on the https://github.com/ckeditor/ckeditor5-engine/issues/796.

szymonkups added a commit to ckeditor/ckeditor5-engine that referenced this issue Dec 12, 2017
Fix: Added a 50ms timeout after `Document#focus` event before rendering to be sure that selection changes are processed on Firefox and Safari. Closes ckeditor/ckeditor5#676. Closes #1157. Closes #1155. Closes #1153.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants