Skip to content

Commit 29ae680

Browse files
committed
Merge branch 't/10866' into major
2 parents e235ac9 + 33405d1 commit 29ae680

File tree

3 files changed

+81
-52
lines changed

3 files changed

+81
-52
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Fixed Issues:
2929
* [#10879](http://dev.ckeditor.com/ticket/10879): Remove format should not leak from nested editable.
3030
* [#10877](http://dev.ckeditor.com/ticket/10877): Fixed: WebSpellChecker fails to apply changes if nested editable was focused.
3131
* [#10870](http://dev.ckeditor.com/ticket/10870): Fixed: `paste` command is not being disabled when clipboard is empty any more.
32+
* [#10866](http://dev.ckeditor.com/ticket/10866): Fixed: Broken *Tab* key navigation in the Image2 dialog.
3233

3334
## CKEditor 4.3 Beta
3435

plugins/dialog/plugin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
23352335
}
23362336
});
23372337

2338+
// Completes this object with everything we have in the
2339+
// definition.
2340+
CKEDITOR.tools.extend( this, elementDefinition );
2341+
23382342
// Register the object as a tab focus if it can be included.
23392343
if ( this.keyboardFocusable ) {
23402344
this.tabIndex = elementDefinition.tabIndex || 0;
@@ -2344,10 +2348,6 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
23442348
dialog._.currentFocusIndex = me.focusIndex;
23452349
});
23462350
}
2347-
2348-
// Completes this object with everything we have in the
2349-
// definition.
2350-
CKEDITOR.tools.extend( this, elementDefinition );
23512351
},
23522352

23532353
/**

plugins/dialogui/plugin.js

Lines changed: 76 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,19 @@ CKEDITOR.plugins.add( 'dialogui', {
130130
var innerHTML = function() {
131131
var html = [],
132132
requiredClass = elementDefinition.required ? ' cke_required' : '';
133-
if ( elementDefinition.labelLayout != 'horizontal' )
134-
html.push( '<label class="cke_dialog_ui_labeled_label' + requiredClass + '" ', ' id="' + _.labelId + '"', ( _.inputId ? ' for="' + _.inputId + '"' : '' ), ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>', elementDefinition.label, '</label>', '<div class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + ' role="presentation">', contentHtml.call( this, dialog, elementDefinition ), '</div>' );
135-
else {
133+
if ( elementDefinition.labelLayout != 'horizontal' ) {
134+
html.push(
135+
'<label class="cke_dialog_ui_labeled_label' + requiredClass + '" ', ' id="' + _.labelId + '"',
136+
( _.inputId ? ' for="' + _.inputId + '"' : '' ),
137+
( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>',
138+
elementDefinition.label,
139+
'</label>',
140+
'<div class="cke_dialog_ui_labeled_content"',
141+
( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ),
142+
' role="radiogroup" aria-labelledby="' + _.labelId + '">',
143+
contentHtml.call( this, dialog, elementDefinition ),
144+
'</div>' );
145+
} else {
136146
var hboxDefinition = {
137147
type: 'hbox',
138148
widths: elementDefinition.widths,
@@ -371,56 +381,76 @@ CKEDITOR.plugins.add( 'dialogui', {
371381
return;
372382

373383
initPrivateObject.call( this, elementDefinition );
384+
374385
if ( !this._[ 'default' ] )
375386
this._[ 'default' ] = this._.initValue = elementDefinition.items[ 0 ][ 1 ];
387+
376388
if ( elementDefinition.validate )
377389
this.validate = elementDefinition.valdiate;
390+
378391
var children = [],
379392
me = this;
380393

381394
var innerHTML = function() {
382-
var inputHtmlList = [],
383-
html = [],
384-
commonAttributes = { 'class': 'cke_dialog_ui_radio_item', 'aria-labelledby': this._.labelId },
385-
commonName = elementDefinition.id ? elementDefinition.id + '_radio' : CKEDITOR.tools.getNextId() + '_radio';
386-
for ( var i = 0; i < elementDefinition.items.length; i++ ) {
387-
var item = elementDefinition.items[ i ],
388-
title = item[ 2 ] !== undefined ? item[ 2 ] : item[ 0 ],
389-
value = item[ 1 ] !== undefined ? item[ 1 ] : item[ 0 ],
390-
inputId = CKEDITOR.tools.getNextId() + '_radio_input',
391-
labelId = inputId + '_label',
392-
inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition, {
393-
id: inputId,
394-
title: null,
395-
type: null
396-
}, true ),
397-
labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition, {
398-
title: title
399-
}, true ),
400-
inputAttributes = {
401-
type: 'radio',
402-
'class': 'cke_dialog_ui_radio_input',
403-
name: commonName,
404-
value: value,
405-
'aria-labelledby': labelId
406-
},
407-
inputHtml = [];
408-
if ( me._[ 'default' ] == value )
409-
inputAttributes.checked = 'checked';
410-
cleanInnerDefinition( inputDefinition );
411-
cleanInnerDefinition( labelDefinition );
412-
413-
if ( typeof inputDefinition.inputStyle != 'undefined' )
414-
inputDefinition.style = inputDefinition.inputStyle;
415-
416-
children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) );
417-
inputHtml.push( ' ' );
418-
new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, { id: labelId, 'for': inputAttributes.id }, item[ 0 ] );
419-
inputHtmlList.push( inputHtml.join( '' ) );
420-
}
421-
new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html );
422-
return html.join( '' );
423-
};
395+
var inputHtmlList = [],
396+
html = [],
397+
commonName = ( elementDefinition.id ? elementDefinition.id : CKEDITOR.tools.getNextId() ) + '_radio';
398+
399+
for ( var i = 0; i < elementDefinition.items.length; i++ ) {
400+
var item = elementDefinition.items[ i ],
401+
title = item[ 2 ] !== undefined ? item[ 2 ] : item[ 0 ],
402+
value = item[ 1 ] !== undefined ? item[ 1 ] : item[ 0 ],
403+
inputId = CKEDITOR.tools.getNextId() + '_radio_input',
404+
labelId = inputId + '_label',
405+
406+
inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition, {
407+
id: inputId,
408+
title: null,
409+
type: null
410+
}, true ),
411+
412+
labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition, {
413+
title: title
414+
}, true ),
415+
416+
inputAttributes = {
417+
type: 'radio',
418+
'class': 'cke_dialog_ui_radio_input',
419+
name: commonName,
420+
value: value,
421+
'aria-labelledby': labelId
422+
},
423+
424+
inputHtml = [];
425+
426+
if ( me._[ 'default' ] == value )
427+
inputAttributes.checked = 'checked';
428+
429+
cleanInnerDefinition( inputDefinition );
430+
cleanInnerDefinition( labelDefinition );
431+
432+
if ( typeof inputDefinition.inputStyle != 'undefined' )
433+
inputDefinition.style = inputDefinition.inputStyle;
434+
435+
// Make inputs of radio type focusable (#10866).
436+
inputDefinition.keyboardFocusable = true;
437+
438+
children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) );
439+
440+
inputHtml.push( ' ' );
441+
442+
new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, {
443+
id: labelId,
444+
'for': inputAttributes.id
445+
}, item[ 0 ] );
446+
447+
inputHtmlList.push( inputHtml.join( '' ) );
448+
}
449+
450+
new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html );
451+
452+
return html.join( '' );
453+
};
424454

425455
CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
426456
this._.children = children;
@@ -1158,9 +1188,7 @@ CKEDITOR.plugins.add( 'dialogui', {
11581188
}
11591189
return null;
11601190
}
1161-
},
1162-
1163-
keyboardFocusable: true
1191+
}
11641192
}, commonPrototype, true );
11651193

11661194
/** @class CKEDITOR.ui.dialog.file */

0 commit comments

Comments
 (0)