Changeset 5068

Show
Ignore:
Timestamp:
2010-02-09 16:15:42 (6 weeks ago)
Author:
garry.yao
Message:

1. Introduce customizable initial dialog focus via 'dialogDefinition.onFocus';
2. 'html' type field focuable with 'elementDefinition.focus = true';

Location:
CKEditor/branches/features/aria/_source/plugins
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • CKEditor/branches/features/aria/_source/plugins/dialog/plugin.js

    r5065 r5068  
    422422                                        this._.currentFocusIndex = -1; 
    423423                                        setupFocus(); 
    424                                         changeFocus( true ); 
     424 
     425                                        // Decide where to put the initial focus. 
     426                                        if ( definition.onFocus ) 
     427                                        { 
     428                                                var initialFocus = definition.onFocus.call( this ); 
     429                                                // Focus the field that the user specified. 
     430                                                initialFocus && initialFocus.focus(); 
     431                                        } 
     432                                        // Focus the first field in layout order. 
     433                                        else 
     434                                                changeFocus( true ); 
     435 
    425436                                        /* 
    426437                                         * IE BUG: If the initial focus went into a non-text element (e.g. button), 
  • CKEditor/branches/features/aria/_source/plugins/dialogui/plugin.js

    r5059 r5068  
    768768 
    769769                                        // Look for focus function in definition. 
    770                                         if ( elementDefinition.focus ) 
     770                                        var focus = elementDefinition.focus; 
     771                                        if ( focus ) 
    771772                                        { 
    772773                                                var oldFocus = this.focus; 
     
    774775                                                { 
    775776                                                        oldFocus.call( this ); 
    776                                                         elementDefinition.focus.call( this ); 
     777                                                        typeof focus == 'function' && focus.call( this ); 
    777778                                                        this.fire( 'focus' ); 
    778779                                                }; 
  • CKEditor/branches/features/aria/_source/plugins/link/dialogs/link.js

    r5065 r5068  
    476476                                                                                        this.allowOnChange = true; 
    477477 
    478                                                                                         // Raise the tab order of this field to top in case of URL. 
    479                                                                                         var linkType = this.getDialog().getContentElement( 'info', 'linkType' ); 
    480                                                                                         if ( linkType && linkType.getValue() == 'url' ) 
    481                                                                                                 this.tabIndex = 1; 
    482  
    483478                                                                                }, 
    484479                                                                                commit : function( data ) 
     
    615610                                                                style : 'text-align: center;', 
    616611                                                                html : '<div role="label" tabIndex="-1">' + CKEDITOR.tools.htmlEncode( editor.lang.link.noAnchors ) + '</div>', 
    617                                                                 focus : function(){}, 
     612                                                                // Focus the first element defined in above html.  
     613                                                                focus : true, 
    618614                                                                setup : function( data ) 
    619615                                                                { 
     
    13651361                                this.hidePage( 'target' );              //Hide Target tab. 
    13661362 
     1363                }, 
     1364                // Inital focus on 'url' field if link is of type URL. 
     1365                onFocus : function() 
     1366                { 
     1367                        var linkType = this.getContentElement( 'info', 'linkType' ); 
     1368                        if ( linkType && linkType.getValue() == 'url' ) 
     1369                                return this.getContentElement( 'info', 'url' ); 
    13671370                } 
    13681371        };