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

Long image alt text protrudes into editor when image is selected #1435

Merged
merged 25 commits into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b421a0f
Added 'width:0;height:0' to hiddenSelection
engineering-this Jan 10, 2018
dcfad4b
Added manual test
engineering-this Jan 10, 2018
98844aa
Added plugin referance to changelog entry
engineering-this Aug 17, 2018
cfd3ea7
Updated test description, updated version tag
engineering-this Jul 24, 2018
9de9d4e
Removed redundant attribute
engineering-this Jul 24, 2018
4f8d97a
Added unit test
engineering-this Jul 24, 2018
2d0f917
Corrected assertions on IE, added comment
engineering-this Jul 24, 2018
00818b5
Added comment referencing issue
engineering-this Jul 24, 2018
4c344ea
Moved and renamed tests
engineering-this Aug 17, 2018
e5d4773
git push Moved TC, asserting all styles
engineering-this Aug 31, 2018
35e142f
typo
engineering-this Aug 31, 2018
292fdce
Updated version tag
engineering-this Aug 31, 2018
df6a216
Fixed manual test file typo.
jacekbogdanski Sep 3, 2018
8410c2e
Corrected unit test name.
jacekbogdanski Sep 3, 2018
b0cfe8a
Refactored tests and fixed styling.
jacekbogdanski Sep 3, 2018
6445fa5
Fixed manual test grammar.
jacekbogdanski Sep 3, 2018
bb88ee4
Added overflow hidden to hidden selection container.
engineering-this Sep 20, 2018
cdd7c9f
Tests: test overflow style.
engineering-this Sep 21, 2018
100a642
Tests: added test steps for JAWS.
engineering-this Sep 21, 2018
b6524ad
Changelog: Moved changelog entry and corrected plugin name.
engineering-this Sep 27, 2018
8d3927c
Tests: renamed TC.
engineering-this Sep 27, 2018
feb9509
Tests: reworked assertion.
engineering-this Sep 27, 2018
12b0c86
Tests: updated test step.
engineering-this Sep 27, 2018
2265b65
Tests: renamed variable.
engineering-this Sep 27, 2018
d4ad381
Fix typo in changelog entry.
Comandeer Sep 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Fixed Issues:
API Changes:

* [#1451](/~https://github.com/ckeditor/ckeditor-dev/issues/1451): Fixed: Context menu is incorrectly positioned when opened with `Shift-F10`.
* [#898](/~https://github.com/ckeditor/ckeditor-dev/issues/898): Fixed: [Image2](https://ckeditor.com/cke4/addon/image2) long alt text protrudes into editor when image is selected.
Copy link
Member

Choose a reason for hiding this comment

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

It's not API change, entry should be in "Fixed Issues" section.

Additionally the name of the plugin is "Enhanced Image", not "Image2".


## CKEditor 4.10.1

Expand Down
2 changes: 1 addition & 1 deletion core/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
// Creates cke_hidden_sel container and puts real selection there.
function hideSelection( editor, ariaLabel ) {
var content = ariaLabel && CKEDITOR.tools.htmlEncode( ariaLabel ) || ' ',
style = CKEDITOR.env.ie && CKEDITOR.env.version < 14 ? 'display:none' : 'position:fixed;top:0;left:-1000px',
style = CKEDITOR.env.ie && CKEDITOR.env.version < 14 ? 'display:none' : 'position:fixed;top:0;left:-1000px;width:0;height:0;overflow:hidden;',
hiddenEl = CKEDITOR.dom.element.createFromHtml(
'<div data-cke-hidden-sel="1" data-cke-temp="1" style="' + style + '">' + content + '</div>',
editor.document );
Expand Down
30 changes: 30 additions & 0 deletions tests/core/selection/fake.js
Original file line number Diff line number Diff line change
Expand Up @@ -1096,5 +1096,35 @@ bender.test( {

assert.areEqual( '<p>[[placeholder]]</p>', editor.getData() );
} );
},

// (#898)
'Test image long alt visibility': function() {
Copy link
Member

Choose a reason for hiding this comment

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

Actually test does not check alt visibility, but styles for hidden selection container.

var bot = this.editorBot,
editor = bot.editor;

bot.setData( '<p>[<span id="bar">bar</span>]</p>', function() {
var altContainer, styles, expected;

editor.getSelection().fake( editor.document.getById( 'bar' ), '<i>foo</i>' );

altContainer = editor.editable().findOne( '[data-cke-hidden-sel]' );
Copy link
Member

Choose a reason for hiding this comment

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

altContainer variable name is misleading, as there isn't any [alt] in it during the test.


if ( CKEDITOR.env.ie && CKEDITOR.env.version < 14 ) {
assert.areEqual( 'none', altContainer.getStyle( 'display' ) );
} else {
styles = CKEDITOR.tools.parseCssText( altContainer.getAttributes().style );
Copy link
Member

Choose a reason for hiding this comment

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

It's safer to check computed styles of the container, not the ones in [style] attribute as they're still possible to overwrite.

expected = {
position: 'fixed',
top: 0,
left: '-1000px',
width: 0,
height: 0,
overflow: 'hidden'
};

assert.isTrue( CKEDITOR.tools.objectCompare( expected, styles ) );
}
} );
}
} );
7 changes: 7 additions & 0 deletions tests/core/selection/manual/hiddenselcontainer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div id="editor">
<p>Test: <img src="%BASE_PATH%/_assets/logo.png" alt="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."></p>
</div>

<script>
CKEDITOR.replace( 'editor' );
</script>
29 changes: 29 additions & 0 deletions tests/core/selection/manual/hiddenselcontainer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@bender-tags: 4.10.2, bug, 898
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, image2

Click on the image
Copy link
Member

Choose a reason for hiding this comment

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

There should be also instructions for testing in JAWS.


## Expected:

There shouldn't be any visible text around the image.

## Unexpected:

There is a visible text around the image.

# Test steps for browsers supporting JAWS text reader:
Copy link
Member

Choose a reason for hiding this comment

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

We only support Firefox + JAWS combo.


1. Open JAWS.
1. Place caret in the text, eg: `Test: ^`.
1. Use right arrow to select the image.

## Expected:

Text reader reads image alt text:

Lorem ipsum dolor sit amet, consetetur sadipscing elitr...

## Unexpected:

Text reader doesn't read image alt text.