1

Topic: AutoFocus on Init

Someone else posted a similar message about page jumping down to the focus of the text area.

I am trying to make it so it doesnt jump halfway down the page.  I can set it the textarea to focus on bye using auto_focus:

I see that is executed here:

if (tinyMCE.settings['auto_focus']) {
window.setTimeout(function () {
var inst = tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);
    inst.selectNode(inst.getBody(), true, true);
    inst.contentWindow.focus();}, 10);
}

I've altered this code to accept a setting of OFF and skip any type of focus and even added code to put focus on one of the form elements. 

I would have thought this was the final piece of code to get run on init but it isnt.  If you set an id for auto_focus: it appears it is the final bit of code.  If you don't it seems to continue on and go some place else.

Can anyone shed some light on this? 

Is there some parameter I can set to absolutely run a plugin or somthing at the very end of all this so it doesnt set focus.

2

Re: AutoFocus on Init

Yeah, that focus stuff is really annoying me.  I have been all over the script, but there are a billion instances of focus.  Were you able to stop the focus from going to tinymce?  How did you do it?

edit** I commented out the line rng.select(); in the TinyMCEControl_selectNode function and that seems to fix it IE (FF doesn't scroll anyway)  I don't think taking out that line hurts anything...at least I haven't found where yet.

3

Re: AutoFocus on Init

Heh. I will look this over for the next release so it doesn't steal focus unless the autofocus option is used.

It seems realy annoying, I agree on that and it was not my intention.
I didn't see this issue since I only use short pages when I do all my editor testing i will make a special testcase for this one aswell. :-)

Best regards,
Spocke - Main developer of TinyMCE

4

Re: AutoFocus on Init

Thats great I will be looking for it.  Thanks for the reply.

5

Re: AutoFocus on Init

Thanks blindlizard and spocke.

I had posted this issue on a separate thread titled "Multiple Text Areas and IE6" earlier. I think it is the same issue as BPeddle reported.

I was looking for some type of confirmation that commenting out rng.select() wasn't going to cause issues - which blindlizard seems to agree with.

Looking forward to a formal "fix" on the next release.

Thanks,

Jijoe

6

Re: AutoFocus on Init

Yepp, the 1.43 release has a fix for this annoying one. smile

Best regards,
Spocke - Main developer of TinyMCE

7

Re: AutoFocus on Init

I enabled auto_focus. I deployed TinyMCE into Tomcat. But I got a strange problem. after the editor shows up, the editor is focused. I use Ctrl + V to paste some text directly, sometimes it works and sometimes not. if I make a click in the edit area, Ctrl + V works. If I click paste icon, then subsequent Ctrl + X works. It seems that sometimes the editor is not really focused even though the cursor is blinking in the editor.

I got this problem in IE. Firefox is fine.

thanks