diff --git a/CHANGES.md b/CHANGES.md index 1d2a807f968..b36099c67cc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,7 @@ Fixed Issues: * [#10879](http://dev.ckeditor.com/ticket/10879): Remove format should not leak from nested editable. * [#10877](http://dev.ckeditor.com/ticket/10877): Fixed: WebSpellChecker fails to apply changes if nested editable was focused. * [#10870](http://dev.ckeditor.com/ticket/10870): Fixed: `paste` command is not being disabled when clipboard is empty any more. +* [#10866](http://dev.ckeditor.com/ticket/10866): Fixed: Broken *Tab* key navigation in the Image2 dialog. ## CKEditor 4.3 Beta diff --git a/plugins/dialog/plugin.js b/plugins/dialog/plugin.js index 573e3f8407c..a6ae585b291 100644 --- a/plugins/dialog/plugin.js +++ b/plugins/dialog/plugin.js @@ -2335,6 +2335,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; } }); + // Completes this object with everything we have in the + // definition. + CKEDITOR.tools.extend( this, elementDefinition ); + // Register the object as a tab focus if it can be included. if ( this.keyboardFocusable ) { this.tabIndex = elementDefinition.tabIndex || 0; @@ -2344,10 +2348,6 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; dialog._.currentFocusIndex = me.focusIndex; }); } - - // Completes this object with everything we have in the - // definition. - CKEDITOR.tools.extend( this, elementDefinition ); }, /** diff --git a/plugins/dialogui/plugin.js b/plugins/dialogui/plugin.js index 55f04e32fe9..6166ca04615 100644 --- a/plugins/dialogui/plugin.js +++ b/plugins/dialogui/plugin.js @@ -130,9 +130,19 @@ CKEDITOR.plugins.add( 'dialogui', { var innerHTML = function() { var html = [], requiredClass = elementDefinition.required ? ' cke_required' : ''; - if ( elementDefinition.labelLayout != 'horizontal' ) - html.push( '', '' ); - else { + if ( elementDefinition.labelLayout != 'horizontal' ) { + html.push( + '', + '
', + contentHtml.call( this, dialog, elementDefinition ), + '
' ); + } else { var hboxDefinition = { type: 'hbox', widths: elementDefinition.widths, @@ -371,56 +381,76 @@ CKEDITOR.plugins.add( 'dialogui', { return; initPrivateObject.call( this, elementDefinition ); + if ( !this._[ 'default' ] ) this._[ 'default' ] = this._.initValue = elementDefinition.items[ 0 ][ 1 ]; + if ( elementDefinition.validate ) this.validate = elementDefinition.valdiate; + var children = [], me = this; var innerHTML = function() { - var inputHtmlList = [], - html = [], - commonAttributes = { 'class': 'cke_dialog_ui_radio_item', 'aria-labelledby': this._.labelId }, - commonName = elementDefinition.id ? elementDefinition.id + '_radio' : CKEDITOR.tools.getNextId() + '_radio'; - for ( var i = 0; i < elementDefinition.items.length; i++ ) { - var item = elementDefinition.items[ i ], - title = item[ 2 ] !== undefined ? item[ 2 ] : item[ 0 ], - value = item[ 1 ] !== undefined ? item[ 1 ] : item[ 0 ], - inputId = CKEDITOR.tools.getNextId() + '_radio_input', - labelId = inputId + '_label', - inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition, { - id: inputId, - title: null, - type: null - }, true ), - labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition, { - title: title - }, true ), - inputAttributes = { - type: 'radio', - 'class': 'cke_dialog_ui_radio_input', - name: commonName, - value: value, - 'aria-labelledby': labelId - }, - inputHtml = []; - if ( me._[ 'default' ] == value ) - inputAttributes.checked = 'checked'; - cleanInnerDefinition( inputDefinition ); - cleanInnerDefinition( labelDefinition ); - - if ( typeof inputDefinition.inputStyle != 'undefined' ) - inputDefinition.style = inputDefinition.inputStyle; - - children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) ); - inputHtml.push( ' ' ); - new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, { id: labelId, 'for': inputAttributes.id }, item[ 0 ] ); - inputHtmlList.push( inputHtml.join( '' ) ); - } - new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html ); - return html.join( '' ); - }; + var inputHtmlList = [], + html = [], + commonName = ( elementDefinition.id ? elementDefinition.id : CKEDITOR.tools.getNextId() ) + '_radio'; + + for ( var i = 0; i < elementDefinition.items.length; i++ ) { + var item = elementDefinition.items[ i ], + title = item[ 2 ] !== undefined ? item[ 2 ] : item[ 0 ], + value = item[ 1 ] !== undefined ? item[ 1 ] : item[ 0 ], + inputId = CKEDITOR.tools.getNextId() + '_radio_input', + labelId = inputId + '_label', + + inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition, { + id: inputId, + title: null, + type: null + }, true ), + + labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition, { + title: title + }, true ), + + inputAttributes = { + type: 'radio', + 'class': 'cke_dialog_ui_radio_input', + name: commonName, + value: value, + 'aria-labelledby': labelId + }, + + inputHtml = []; + + if ( me._[ 'default' ] == value ) + inputAttributes.checked = 'checked'; + + cleanInnerDefinition( inputDefinition ); + cleanInnerDefinition( labelDefinition ); + + if ( typeof inputDefinition.inputStyle != 'undefined' ) + inputDefinition.style = inputDefinition.inputStyle; + + // Make inputs of radio type focusable (#10866). + inputDefinition.keyboardFocusable = true; + + children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) ); + + inputHtml.push( ' ' ); + + new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, { + id: labelId, + 'for': inputAttributes.id + }, item[ 0 ] ); + + inputHtmlList.push( inputHtml.join( '' ) ); + } + + new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html ); + + return html.join( '' ); + }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); this._.children = children; @@ -1158,9 +1188,7 @@ CKEDITOR.plugins.add( 'dialogui', { } return null; } - }, - - keyboardFocusable: true + } }, commonPrototype, true ); /** @class CKEDITOR.ui.dialog.file */