|
466 | 466 | });
|
467 | 467 | }
|
468 | 468 |
|
| 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 | + |
469 | 477 | // The above is all we'll be doing for a <textarea> editable.
|
470 | 478 | if ( this.is( 'textarea' ) )
|
471 | 479 | return;
|
|
483 | 491 | if ( this.getDirection( 1 ) != dir )
|
484 | 492 | this.changeAttr( 'dir', dir );
|
485 | 493 |
|
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 |
| - |
494 | 494 | // Create the content stylesheet for this document.
|
495 | 495 | var styles = CKEDITOR.getCss();
|
496 | 496 | if ( styles ) {
|
|
913 | 913 | !isDirty && editor.resetDirty();
|
914 | 914 | }
|
915 | 915 | });
|
| 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(); |
916 | 925 |
|
| 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 | + }); |
917 | 947 | });
|
918 | 948 |
|
919 | 949 | // #9222: Show text cursor in Gecko.
|
|
0 commit comments