Changeset 12747

Show
Ignore:
Timestamp:
02/27/08 15:29:13 (6 months ago)
Author:
doughays
Message:

Fixes #5968. On IE, the focus was being set to each Editor as it was rendered which was trumping the focusOnLoad. I made each editor temporarily unselectable in IE which prevented incorrect focusing. This also fixes the onChange problem in IE were the first onChange did not fire because the automatic focus was not detected by the widget.

Location:
dijit/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/tests/test_Editor.html

    r12703 r12747  
    6464        <h2>Created from div</h2> 
    6565        <div style="border: 1px solid black;"> 
    66                 <div dojoType="dijit.Editor" id="editor1"><p>This instance is created from a div directly with default toolbar and plugins</p></div> 
     66                <div dojoType="dijit.Editor" id="editor1" 
     67                        onChange="console.log('user onChange handler: ' + arguments[0])" 
     68                ><p>This instance is created from a div directly with default toolbar and plugins</p></div> 
    6769        </div> 
    6870        <button onClick="dijit.byId('editor1').destroy()">destroy</button> 
  • dijit/trunk/_editor/RichText.js

    r12702 r12747  
    611611        setDisabled: function(/*Boolean*/ disabled){ 
    612612                if(dojo.isIE || dojo.isSafari || dojo.isOpera){ 
    613                         this.editNode.contentEditable=!disabled; 
     613                        if(dojo.isIE){ this.editNode.unselectable = "on"; } // prevent IE from setting focus 
     614                        this.editNode.contentEditable=!disabled; 
     615                        if(dojo.isIE){ 
     616                                var _this = this; 
     617                                setTimeout(function(){ _this.editNode.unselectable = "off"; }, 0); 
     618                        } 
    614619                }else{ //moz 
    615620                        if(disabled){ 
     
    680685 
    681686                if(this.focusOnLoad){ 
    682                         this.focus(); 
     687                        setTimeout(dojo.hitch(this, "focus"), 0); // have to wait for IE to set unselectable=off 
    683688                } 
    684689