Changeset 4939
- Timestamp:
- 01/18/10 12:22:45 (3 years ago)
- Location:
- CKEditor/branches/features/aria/_source/plugins
- Files:
-
- 3 edited
-
accessibility/plugin.js (modified) (5 diffs)
-
dialog/plugin.js (modified) (1 diff)
-
wysiwygarea/plugin.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/branches/features/aria/_source/plugins/accessibility/plugin.js
r4935 r4939 14 14 // List of in-use ARIA roles and states. 15 15 var roles = [ 'role' ], 16 // List of roles that role type should not be announced. 17 silentRoles = { 'region' : 1 }, 16 18 states = [ 'label', 'labelledby', 'describedby', 'multiline' ], 17 19 length = Math.max( roles.length, states.length ); 18 19 20 20 21 function lookupARIASupport( role, tagName ) 21 22 { 22 23 return { 23 // Only Firefox3 support the "dialog" role.24 24 'dialog' : env.gecko && CKEDITOR.env.version >= 10900, 25 // IE doesn't support editing iframe as region. 26 'region' : env.gecko || ( env.ie && tagName != 'iframe' ) 25 'region' : env.gecko && CKEDITOR.env.version >= 10900 27 26 }[ role ]; 28 27 } … … 31 30 * Bring degradeable substitution to standard ARIA widgets. 32 31 * @param element 33 * @param isOffline34 32 */ 35 function degradeARIA( element, isOffline)33 function degradeARIA( element, editor ) 36 34 { 37 35 // Save the interested ARIA attributes first. … … 47 45 labelText = element.getAttribute( 'aria-label' ) || ( attrValue = element.getAttribute( 'aria-labelledby' ) ) && doc.getById( attrValue ).getText() || '', 48 46 descriptionText = ( attrValue = element.getAttribute( 'aria-describedby' ) ) && doc.getById( attrValue ).getText() || '', 49 legend = [ labelText,role, descriptionText ].join( ' ' );47 allInOne = [ labelText, role in silentRoles ? '' : role, descriptionText ].join( ' ' ); 50 48 51 49 // Remove all ARIA attributes on the widget that could … … 57 55 } 58 56 59 // Translate by wrapping with a form field legend that contains all ARIA 60 // attributes which leads to be announced by ATs. 61 var fieldset = CKEDITOR.dom.element.createFromHtml( 62 '<fieldset class="cke_voicelabel_invisible">' + 63 '<legend class="cke_voicelabel_invisible">' + 64 CKEDITOR.tools.htmlEncode( legend ) + 65 '</legend>' + 66 '</fieldset>', doc ); 57 // Translate 'dialog' role by wrapping all containing form fields with a legend that composed of all ARIA 58 // attributes of the dialog which leads to be announced by ATs. 59 if( role == 'dialog' ) 60 { 61 var fieldset = CKEDITOR.dom.element.createFromHtml( 62 '<fieldset class="cke_voicelabel_invisible">' + 63 '<legend class="cke_voicelabel_invisible">' + 64 CKEDITOR.tools.htmlEncode( allInOne ) + 65 '</legend>' + 66 '</fieldset>', doc ); 67 67 68 if( !isOffline )69 {70 68 var parent; 71 69 while( ( parent = element.getParent() ) && !parent.getDtd()[ fieldset.getName() ] ) 72 70 element = parent; 73 71 fieldset.insertBefore( element ); 72 fieldset.append( element ); 73 return fieldset; 74 74 } 75 76 fieldset.append( element ); 77 return fieldset; 75 // The only reliable substitution of aria-label on an iframe 76 // is to use the content window title of that frame. 77 else if ( element.is( 'iframe' ) ) 78 { 79 // We can only occupy the title when editor is not in full-page mode. 80 !editor.config.fullPage && 81 ( element.$.contentWindow.document.title = allInOne ); 82 } 78 83 } 79 84 … … 84 89 editor.on( 'ariaWidget', function( evt ) 85 90 { 86 var data = evt.data, 87 widget = data.element, 88 widgetIsOffline = !data.replace; 89 data.element = degradeARIA( widget, widgetIsOffline ); 91 degradeARIA( evt.data, editor ); 90 92 } ); 91 93 } -
CKEditor/branches/features/aria/_source/plugins/dialog/plugin.js
r4926 r4939 152 152 CKEDITOR.tools.setTimeout( function() 153 153 { 154 editor.fire( 'ariaWidget', { element : this.parts.contents, replace : true });154 editor.fire( 'ariaWidget', this.parts.contents ); 155 155 }, 0, this ); 156 156 -
CKEditor/branches/features/aria/_source/plugins/wysiwygarea/plugin.js
r4932 r4939 275 275 '})())"' : '' ) + 276 276 ' tabIndex="-1"' + 277 ' title=" wysiwgy mode"' + 277 278 ' allowTransparency="true"' + 278 279 ' role="region"' + … … 297 298 } ); 298 299 299 mainElement.append( editor.fire( 'ariaWidget', { element : iframe } ).element);300 mainElement.append( iframe ); 300 301 }; 301 302 … … 312 313 if ( frameLoaded ) 313 314 return; 314 315 315 frameLoaded = 1; 316 317 editor.fire( 'ariaWidget', iframe ); 316 318 317 319 var domDocument = domWindow.document, … … 612 614 config.docType + 613 615 '<html dir="' + config.contentsLangDirection + '">' + 616 '<title>' + frameLabel + '</title>' + 614 617 '<head>' + 615 618 baseTag + 616 619 headExtra + 617 '</head>' + 620 '</head>' + 618 621 '<body' + ( config.bodyId ? ' id="' + config.bodyId + '"' : '' ) + 619 622 ( config.bodyClass ? ' class="' + config.bodyClass + '"' : '' ) +
Note: See TracChangeset
for help on using the changeset viewer.
