Skip to content

Commit da498c3

Browse files
committed
Merge branch 't/9541'
2 parents 8ae6b55 + c551fd8 commit da498c3

File tree

3 files changed

+42
-18
lines changed

3 files changed

+42
-18
lines changed

core/creators/themedui.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ CKEDITOR.replaceClass = 'ckeditor';
152152
// Detach the current editable.
153153
editor.editable( 0 );
154154

155+
// Clear up the mode space.
156+
editor.ui.space( 'contents' ).setHtml( '' );
157+
155158
editor.mode = '';
156159
}
157160

core/editable.js

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,14 @@
466466
});
467467
}
468468

469+
// Apply tab index on demand, with original direction saved.
470+
if ( this.isInline() ) {
471+
472+
// tabIndex of the editable is different than editor's one.
473+
// Update the attribute of the editable.
474+
this.changeAttr( 'tabindex', editor.tabIndex );
475+
}
476+
469477
// The above is all we'll be doing for a <textarea> editable.
470478
if ( this.is( 'textarea' ) )
471479
return;
@@ -483,14 +491,6 @@
483491
if ( this.getDirection( 1 ) != dir )
484492
this.changeAttr( 'dir', dir );
485493

486-
// Apply tab index on demand, with original direction saved.
487-
if ( editor.document.equals( CKEDITOR.document ) ) {
488-
489-
// tabIndex of the editable is different than editor's one.
490-
// Update the attribute of the editable.
491-
this.changeAttr( 'tabindex', editor.tabIndex );
492-
}
493-
494494
// Create the content stylesheet for this document.
495495
var styles = CKEDITOR.getCss();
496496
if ( styles ) {
@@ -913,7 +913,37 @@
913913
!isDirty && editor.resetDirty();
914914
}
915915
});
916+
});
917+
918+
919+
CKEDITOR.on( 'instanceCreated', function( evt ) {
920+
var editor = evt.editor;
921+
922+
editor.on( 'mode', function() {
923+
924+
var editable = editor.editable();
916925

926+
// Setup proper ARIA roles and properties for inline editable, framed
927+
// editable is instead handled by plugin.
928+
if ( editable.isInline() ) {
929+
930+
var ariaLabel = [ this.lang.editor, this.name ].join( ',' );
931+
932+
editable.changeAttr( 'role', 'textbox' );
933+
editable.changeAttr( 'aria-label', ariaLabel );
934+
editable.changeAttr( 'title', ariaLabel );
935+
936+
// Put the voice label in different spaces, depending on element mode, so
937+
// the DOM element get auto detached on mode reload or editor destroy.
938+
var ct = this.ui.space( this.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? 'top' : 'contents' );
939+
if ( ct ) {
940+
var ariaDescId = CKEDITOR.tools.getNextId(),
941+
desc = CKEDITOR.dom.element.createFromHtml( '<span id="' + ariaDescId + '" class="cke_voice_label">' + this.lang.common.editorHelp + '</span>' );
942+
ct.append( desc );
943+
editable.changeAttr( 'aria-describedby', ariaDescId );
944+
}
945+
}
946+
});
917947
});
918948

919949
// #9222: Show text cursor in Gecko.

plugins/sourcearea/plugin.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@
3434
},
3535
CKEDITOR.tools.cssVendorPrefix( 'tab-size', editor.config.sourceAreaTabSize || 4 ) ) );
3636

37-
var ariaLabel = [ editor.lang.editor, editor.name ].join( ',' );
38-
39-
textarea.setAttributes({
40-
dir: 'ltr',
41-
tabIndex: CKEDITOR.env.webkit ? -1 : editor.tabIndex,
42-
'role': 'textbox',
43-
'aria-label': ariaLabel
44-
});
45-
4637
textarea.addClass( 'cke_source cke_reset cke_enable_context_menu' );
4738

4839
editor.ui.space( 'contents' ).append( textarea );
@@ -155,4 +146,4 @@ CKEDITOR.plugins.sourcearea = {
155146
* @cfg {Number} [sourceAreaTabSize=4]
156147
* @member CKEDITOR.config
157148
* @see CKEDITOR.config#dataIndentationChars
158-
*/
149+
*/

0 commit comments

Comments
 (0)