Skip to content

Commit 24b4fc5

Browse files
committed
Merge branch 't/12204'
2 parents f9c98f4 + 1e2ce1d commit 24b4fc5

File tree

4 files changed

+54
-32
lines changed

4 files changed

+54
-32
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Fixed Issues:
2323
* [#12215](http://dev.ckeditor.com/ticket/12215): Fixed: Basepath resolution doesn't recognize semicolon as a query separator.
2424
* [#12135](http://dev.ckeditor.com/ticket/12135): Fixed: Remove format does not work on widgets.
2525
* [#12298](http://dev.ckeditor.com/ticket/12298): [IE11] Fixed: Clicking below body in Compatibility Mode will no longer reset selection to the first line.
26+
* [#12204](http://dev.ckeditor.com/ticket/12204): Fixed: Editor's voice label is not affected by [`config.title`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-title).
2627

2728
Other Changes:
2829

core/creators/themedui.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,6 @@ CKEDITOR.replaceClass = 'ckeditor';
370370
}
371371
}
372372

373-
var themedTpl;
374-
375373
function loadTheme( editor ) {
376374
var name = editor.name,
377375
element = editor.element,
@@ -381,29 +379,29 @@ CKEDITOR.replaceClass = 'ckeditor';
381379
var topHtml = editor.fire( 'uiSpace', { space: 'top', html: '' } ).html;
382380
var bottomHtml = editor.fire( 'uiSpace', { space: 'bottom', html: '' } ).html;
383381

384-
if ( !themedTpl ) {
385-
themedTpl = CKEDITOR.addTemplate( 'maincontainer', '<{outerEl}' +
382+
var themedTpl = new CKEDITOR.template(
383+
'<{outerEl}' +
386384
' id="cke_{name}"' +
387385
' class="{id} cke cke_reset cke_chrome cke_editor_{name} cke_{langDir} ' + CKEDITOR.env.cssClass + '" ' +
388386
' dir="{langDir}"' +
389387
' lang="{langCode}"' +
390388
' role="application"' +
391-
' aria-labelledby="cke_{name}_arialbl">' +
392-
'<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' +
393-
'<{outerEl} class="cke_inner cke_reset" role="presentation">' +
394-
'{topHtml}' +
395-
'<{outerEl} id="{contentId}" class="cke_contents cke_reset" role="presentation"></{outerEl}>' +
396-
'{bottomHtml}' +
397-
'</{outerEl}>' +
398-
'</{outerEl}>' );
399-
}
389+
( editor.title ? ' aria-labelledby="cke_{name}_arialbl"' : '' ) +
390+
'>' +
391+
( editor.title ? '<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' : '' ) +
392+
'<{outerEl} class="cke_inner cke_reset" role="presentation">' +
393+
'{topHtml}' +
394+
'<{outerEl} id="{contentId}" class="cke_contents cke_reset" role="presentation"></{outerEl}>' +
395+
'{bottomHtml}' +
396+
'</{outerEl}>' +
397+
'</{outerEl}>' );
400398

401399
var container = CKEDITOR.dom.element.createFromHtml( themedTpl.output( {
402400
id: editor.id,
403401
name: name,
404402
langDir: editor.lang.dir,
405403
langCode: editor.langCode,
406-
voiceLabel: [ editor.lang.editor, editor.name ].join( ', ' ),
404+
voiceLabel: editor.title,
407405
topHtml: topHtml ? '<span id="' + editor.ui.spaceId( 'top' ) + '" class="cke_top cke_reset_all" role="presentation" style="height:auto">' + topHtml + '</span>' : '',
408406
contentId: editor.ui.spaceId( 'contents' ),
409407
bottomHtml: bottomHtml ? '<span id="' + editor.ui.spaceId( 'bottom' ) + '" class="cke_bottom cke_reset_all" role="presentation">' + bottomHtml + '</span>' : '',

plugins/floatingspace/plugin.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,7 @@
44
*/
55

66
( function() {
7-
var floatSpaceTpl = CKEDITOR.addTemplate( 'floatcontainer', '<div' +
8-
' id="cke_{name}"' +
9-
' class="cke {id} cke_reset_all cke_chrome cke_editor_{name} cke_float cke_{langDir} ' + CKEDITOR.env.cssClass + '"' +
10-
' dir="{langDir}"' +
11-
' title="' + ( CKEDITOR.env.gecko ? ' ' : '' ) + '"' +
12-
' lang="{langCode}"' +
13-
' role="application"' +
14-
' style="{style}"' +
15-
' aria-labelledby="cke_{name}_arialbl"' +
16-
'>' +
17-
'<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' +
18-
'<div class="cke_inner">' +
19-
'<div id="{topId}" class="cke_top" role="presentation">{content}</div>' +
20-
'</div>' +
21-
'</div>' ),
22-
win = CKEDITOR.document.getWindow(),
7+
var win = CKEDITOR.document.getWindow(),
238
pixelate = CKEDITOR.tools.cssLength;
249

2510
CKEDITOR.plugins.add( 'floatingspace', {
@@ -278,15 +263,31 @@
278263
} )();
279264

280265
if ( topHtml ) {
281-
var floatSpace = CKEDITOR.document.getBody().append( CKEDITOR.dom.element.createFromHtml( floatSpaceTpl.output( {
266+
var floatSpaceTpl = new CKEDITOR.template(
267+
'<div' +
268+
' id="cke_{name}"' +
269+
' class="cke {id} cke_reset_all cke_chrome cke_editor_{name} cke_float cke_{langDir} ' + CKEDITOR.env.cssClass + '"' +
270+
' dir="{langDir}"' +
271+
' title="' + ( CKEDITOR.env.gecko ? ' ' : '' ) + '"' +
272+
' lang="{langCode}"' +
273+
' role="application"' +
274+
' style="{style}"' +
275+
( editor.title ? ' aria-labelledby="cke_{name}_arialbl"' : ' ' ) +
276+
'>' +
277+
( editor.title ? '<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' : ' ' ) +
278+
'<div class="cke_inner">' +
279+
'<div id="{topId}" class="cke_top" role="presentation">{content}</div>' +
280+
'</div>' +
281+
'</div>' ),
282+
floatSpace = CKEDITOR.document.getBody().append( CKEDITOR.dom.element.createFromHtml( floatSpaceTpl.output( {
282283
content: topHtml,
283284
id: editor.id,
284285
langDir: editor.lang.dir,
285286
langCode: editor.langCode,
286287
name: editor.name,
287288
style: 'display:none;z-index:' + ( config.baseFloatZIndex - 1 ),
288289
topId: editor.ui.spaceId( 'top' ),
289-
voiceLabel: editor.lang.editorPanel + ', ' + editor.name
290+
voiceLabel: editor.title
290291
} ) ) ),
291292

292293
// Use event buffers to reduce CPU load when tons of events are fired.

tests/core/editor/title.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* bender-tags: editor,unit */
2+
/* bender-ckeditor-plugins: wysiwygarea,floatingspace,toolbar */
23

34
( function() {
45
'use strict';
@@ -145,6 +146,10 @@
145146
return editable.isInline() ? editable : editor.window.getFrame();
146147
}
147148

149+
function getVoiceLabel( editor ) {
150+
return CKEDITOR.document.getById( 'cke_' + editor.name + '_arialbl' );
151+
}
152+
148153
function assertTitle( expected, editor, msg ) {
149154
assert.areSame(
150155
expected,
@@ -170,6 +175,17 @@
170175
assert.isTrue( !!~element.getAttribute( 'title' ).indexOf( editor.title ), 'editor.title used as an attribute of editable of ' + editor.name );
171176
}
172177

178+
function assertVoiceLabelIsBasedOnTitle( editor ) {
179+
var element = getVoiceLabel( editor );
180+
181+
if ( !editor.title ) {
182+
assert.isNull( element, 'editor: ' + editor.name );
183+
} else {
184+
assert.isNotNull( element, 'editor: ' + editor.name + ' - element' )
185+
assert.areSame( editor.title, element.getText(), 'editor: ' + editor.name + ' - value' );
186+
}
187+
}
188+
173189
setUpEditors();
174190

175191
var tests = {
@@ -207,6 +223,12 @@
207223
assertTitleSetOnEditable( editors[ i ] );
208224
},
209225

226+
'test voice label have properly set title': function() {
227+
for ( var i in editors ) {
228+
assertVoiceLabelIsBasedOnTitle( editors[ i ] );
229+
}
230+
},
231+
210232
'test restore title after instance is destroyed': function() {
211233
var tcs = {
212234
existing1: 'foo',

0 commit comments

Comments
 (0)