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

[#17028] Tabbing through inline editor causes JavaScript error. #451

Merged
merged 11 commits into from
Jun 13, 2017
Merged

[#17028] Tabbing through inline editor causes JavaScript error. #451

merged 11 commits into from
Jun 13, 2017

Conversation

msamsel
Copy link
Contributor

@msamsel msamsel commented Jun 1, 2017

What is the purpose of this pull request?

Bug fix
It's PR related to #424

Does your PR contain necessary tests?

yes

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

Add checks in 2 places that values are defined.

close #424

@Comandeer Comandeer self-requested a review June 2, 2017 11:35
Copy link
Member

@Comandeer Comandeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is not working correctly. After tabbing into editor, there is no caret inside and it's impossible to type anything. This is probably caused by the fact that in Chrome selection is removed from window when blurring inline editor → http://dev.ckeditor.com/ticket/13446

The real fix for this issue would be ensure that elements path is always set when focusing the editor. In other words: ensure that there is a caret inside newly focused editor.

<head>
<script>
if ( bender.tools.env.mobile ) {
bender.ignore;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bender.ignore is a function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups.
Done.

@msamsel msamsel changed the title [#170028] Tabbing through inline editor causes JavaScript error. [#17028] Tabbing through inline editor causes JavaScript error. Jun 6, 2017
@msamsel
Copy link
Contributor Author

msamsel commented Jun 7, 2017

It seems that problem start to occur after introducing change in 3f07b6d.
Problem describe there seems to be fixed in Chrome v57. I revert this change and make slightly modification in Unit test. As I see chrome completely remove selection so reading type throw an error. Now test check if native selection exists.

@Comandeer Comandeer self-requested a review June 9, 2017 08:32
@@ -0,0 +1,12 @@
@bender-tags: 4.7.1, tc, gh424
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update tags to the new convention.

@@ -0,0 +1,12 @@
@bender-tags: 4.7.1, tc, gh424
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update tags to the new convention.

if ( editor.mode != 'wysiwyg' )
return;

if ( evt.data.keyCode == this.indentKey ) {
var list = this.getContext( editor.elementPath() );
// Prevent of getting context of empty path. (#17028)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update ticket number.

@@ -57,6 +57,11 @@
// Backward compact.
root = root || startNode.getDocument().getBody();

// Assign root value if startNode is null (#17028).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update ticket number.

@@ -109,7 +109,12 @@ bender.test( {
resume( function() {
editor.on( 'blur', function() {
resume( function() {
assert.areSame( 'None', editor.getSelection().getNative().type );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these tests still needed? It seems that now they're checking the native Chrome's implementation.

There is also manual test for it (core/focusmanager/manual/typinginunfocusedinlineeditor), which became unneeded.

@Comandeer Comandeer self-requested a review June 12, 2017 07:06
Copy link
Member

@Comandeer Comandeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but there are some cleanup tasks left. Let's do them and finish this PR!

@@ -57,6 +57,11 @@
// Backward compact.
root = root || startNode.getDocument().getBody();

// Assign root value if startNode is null (https://dev.ckeditor.com/ticket/17028).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update tickets numbers to the new convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Comandeer I'm a little bit confused, according to #470, there should be permanent link to issue in track. And it is there, or do I missed something?
Or by new convention you understand reference to github issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I mean adding reference to GH issue alongside the reference to trac.

if ( editor.mode != 'wysiwyg' )
return;

if ( evt.data.keyCode == this.indentKey ) {
var list = this.getContext( editor.elementPath() );
// Prevent of getting context of empty path (https://dev.ckeditor.com/ticket/17028).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update tickets numbers to the new convention.

@@ -0,0 +1,12 @@
@bender-tags: 4.7.1, tc, 424
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update tags to the new bug/feature convention.

Additionally this test does not make much sense in browsers other than Chrome (as this thing was always working there) – let's run it only in Chrome.

};

bender.test({
'test tab in inline editor': function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add ticket reference here, just for clarity?

};

bender.test({
'test tab in inline editor': function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add ticket reference here, just for clarity?

@@ -0,0 +1,12 @@
@bender-tags: 4.7.1, tc, 424
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update tags to the new bug/feature convention.

Additionally this test does not make much sense in browsers other than Chrome (as this thing was always working there) – let's run it only in Chrome.

@@ -0,0 +1,40 @@
<head>
<script>
if ( !CKEDITOR.env.chrome ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it to the script in body as it apparently does not work in head.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting.
when I fired the test from link:
http://tests.ckeditor.dev:1030/#tests/path:/tests/plugins/indentlist/manual with a play button it seemd to be ignored, but there is no notification when test is opened directly.

I moved condition to body to work properly.

@@ -0,0 +1,40 @@
<head>
<script>
if ( !CKEDITOR.env.chrome ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it to the script in body as it apparently does not work in head.

@Comandeer Comandeer self-requested a review June 13, 2017 09:28
@Comandeer Comandeer merged commit 2354a28 into ckeditor:master Jun 13, 2017
@Comandeer Comandeer deleted the t/17028 branch June 13, 2017 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants