Roundcube Community Forum

 

Problem setting focus when replying to messasge (IE7, javascript error)

Started by jimwillsher, February 25, 2009, 11:05:04 AM

Previous topic - Next topic

jimwillsher

Hi all,

I'm a newbie to Roundcube, having left trusty SquirrelMail behind yesterday.

I'm not sure if I'm missing something, but I'm finding a problem when replying to emails. I have HTML formatting enabled, so it could be a TinyMCE issue, but I'm not sure.

When I reply, the editing window doesn't get focus (cursor) and I'm getting a javascript error:

Line: 3170
Char: 1
Error: Can't move focus to the control becuase it is invisible, not enabled, or of a type that does not accept the focus
Code: 0


I know that javascript errors in IE are often misleading in their line numbers. I only found one .js file which had > 3000 lines in it, but I'm not convinced I'm in the right place.

Can anyone suggest where I might start debugging, or is there a known resolution other than Firefox :D)

IE7, fully patched, Vista x64.

Many thanks,


Jim

rosali

Regards,
Rosali

jimwillsher

Many thanks for the link. It's now installed and working, and this seems to be the path to the error:

app.js ( line 168 ) this.init_messageform();
app.js ( line 380 ) this.set_caret2start(_3a);

Line 3169  obj.focus();



As the code is clearly obfuscated it's hard to work out what's going on. So does that give the developers enough info?

My system is fully-patched Vista x64 (using the 32-bit browser). I have no IE addons. The problem only occurs when replying to HTML emails (in HTML format).


Many thanks,



Jim

lacri

Hi
rename the app.js to app.js.original and
rename the app.js.src to  app.js

this is the unpacked and developer version from app.js and is human readable.

jimwillsher

Many thanks.

Ok, the offending code is this:

this.set_caret2start = function(obj)
    {
    if (obj.createTextRange)
      {
      var range = obj.createTextRange();
      range.collapse(true);
      range.select();
      }
    else if (obj.setSelectionRange)
      obj.setSelectionRange(0,0);

    obj.focus();    };

Unfortunately I'm no javascript - other languages are my area. Can anyone suggest a way forward?

Cheers,


Jim

rosali

Regards,
Rosali

jimwillsher

Hmm....it stops the error, but doesn't give focus to the field, which is a bit of a pain. I need to click the reply field, then jump to the start of the message.

It works correctly when using plain-text emails, so for now I'll just revert back to plain-text and disable the "Compose HTML messages" option.

Many thanks for your help.


Jim

rosali

The problem is, that IE does not allow to give focus to an invisible/hidden textarea. I would have to look deeper inside TinyMCE, if there is a way to set the focus into the TinyMCE layer.

TinyMCE:Configuration/auto focus - Moxiecode Documentation Wiki
Regards,
Rosali