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

Fixed focusing a widget after blurring editor for edge #1466

Merged
merged 7 commits into from
Mar 6, 2018
Merged

Conversation

jacekbogdanski
Copy link
Member

@jacekbogdanski jacekbogdanski commented Jan 17, 2018

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

Added condition to focus editor for CKEDITOR.plugins.copyformatting.state#applyFormatting event only when client browser is IE .
Closes #1458

Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

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

In the PR description you marked it contains unit test, but I don't see any. It would be good to add some.

@@ -414,7 +414,7 @@
},

applyFormatting: {
editorFocus: false,
editorFocus: CKEDITOR.env.ie && !CKEDITOR.env.edge ? false : true,
Copy link
Contributor

Choose a reason for hiding this comment

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

With such condition (CKEDITOR.env.ie && !CKEDITOR.env.edge) you will get false for all IEs and true for Edge and all other browsers different than IEs.
From what I understand it should be true only for Edge and false for others, so in this case it should be CKEDITOR.env.ie && CKEDITOR.env.edge ? true : false.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it should be false for an IE. It is old fix where IE with editor focus will scroll up if an image is at the bottom of a scrollable container bdbd071.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I see, after F2F talk, the reason was to rollback the editorFocus: false change as initially it should be applied only for IEs, but was applied for all browsers (see https://dev.ckeditor.com/ticket/16845). So now editorFocus: false should be only used for IEs.
That was also a reason for modifying manual test (which is answer for #1466 (comment)).

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for misleading information about unit tests. As we talked F2F there is no easy way to test this issue directly in the code, so I will skip this part and use manual tests.

@@ -0,0 +1,18 @@
@bender-tags: bug, 4.8.1, copyformatting, 1458
Copy link
Contributor

Choose a reason for hiding this comment

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

Target version should be 4.9.0.

}

CKEDITOR.replace( 'editor1', {
width: '30em',
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if such detailed width and height is needed, was there any particular reason for this?

@@ -1,4 +1,4 @@
@bender-tags: bug, 4.7.0, trac16845, copyformatting
@bender-tags: bug, 4.7.0, trac16845, copyformatting, 1458
Copy link
Contributor

Choose a reason for hiding this comment

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

If this test is important for this fix it should also contain 4.9.0 version tag. If not, you shouldn't have added 1458 ticket number.

</textarea>

<script>
CKEDITOR.replace( 'editor1' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, from what I understand this was the Edge only fix, what was the reason of removing

if ( !CKEDITOR.env.ie ) {		
 	bender.ignore();		
 }

ignore from this test? Does the changes somehow affect other browsers?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem was with IE, but older fix corrupted Edge, so I thought it's good idea to test all other browsers.

Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Just some details in tests needs fixing.

@@ -0,0 +1,18 @@
@bender-tags: bug, 4.9.0, copyformatting, 1458
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update tag to 4.9.1.

@@ -0,0 +1,18 @@
@bender-tags: bug, 4.9.0, copyformatting, 1458
@bender-ui: collapsed
@bender-ckeditor-plugins: copyformatting,toolbar,wysiwygarea,floatingspace,elementspath,image2,widget,justify,div
Copy link
Contributor

@f1ames f1ames Feb 21, 2018

Choose a reason for hiding this comment

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

You could easily run this test with only copyformatting,toolbar,wysiwygarea,image2. No need for additional plugins.

## Test Scenario

1. Make sure the editor is not focused.
2. Select the image on the left by clicking it.
Copy link
Contributor

Choose a reason for hiding this comment

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

by clicking on it.


1. Make sure the editor is not focused.
2. Select the image on the left by clicking it.
3. Remove selection from the image by clicking outside of the editor.
Copy link
Contributor

Choose a reason for hiding this comment

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

outside of the editor.

@@ -0,0 +1,41 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this blank line really necessary?

@@ -1,4 +1,4 @@
@bender-tags: bug, 4.7.0, trac16845, copyformatting
@bender-tags: bug, 4.7.0, 4.9.0, trac16845, copyformatting, 1458
@bender-ui: collapsed
@bender-ckeditor-plugins: copyformatting,toolbar,wysiwygarea,floatingspace,elementspath,image2,widget,justify,div
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, you only need copyformatting,toolbar,wysiwygarea,image2,justify,div (I know this tests was not added by this PR, but it is a good opportunity to fix it:D).

Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@f1ames
Copy link
Contributor

f1ames commented Feb 21, 2018

Should be merged to master after 4.9.0 release.

@mlewand
Copy link
Contributor

mlewand commented Mar 6, 2018

Retargetting into a next branch (4.10.0 release) as current major is frozen for the 4.9.0 release.

@mlewand mlewand changed the base branch from major to next March 6, 2018 10:32
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.

4 participants