roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.81k stars 1.63k forks source link

Savedraft lose focus on current active input field #5223

Closed fabioperrella closed 8 years ago

fabioperrella commented 8 years ago

Hi!

When rcmail.submit_messageform(true) is called to save draft, the focus on current element is lost.

For example, if I'm writing the subject, the cursor is moved to the message body

I think the problem is the form is inside an iframe and after submiting on form.subimt() (https://github.com/roundcube/roundcubemail/blob/master/program/js/app.js#L4149) the focus is moved to the iframe (tinymce)

One possible solution would be to use $.ajax({ type: 'POST', url: form.action, data: $(form).serialize())

alecpl commented 8 years ago

What are the steps to reproduce? I don't see this on draft auto-save. What browser?

fabioperrella commented 8 years ago

The steps are:

alecpl commented 8 years ago

OK, confirmed, using Firefox.

alecpl commented 8 years ago

Problem is here https://github.com/roundcube/roundcubemail/blob/master/program/js/editor.js#L453 Either we investigate this line is needed at all or we have two options:

  1. put the focus on the previously focused element after getting editor content
  2. or I think we could just call this focus() only when args.selection=true.