After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744077 - Focus lost after composer is detached
Focus lost after composer is detached
Status: RESOLVED FIXED
Product: geary
Classification: Other
Component: composer
master
Other Linux
: Normal normal
: ---
Assigned To: Geary Maintainers
Geary Maintainers
review
Depends on:
Blocks:
 
 
Reported: 2015-02-05 22:53 UTC by Jim Nelson
Modified: 2015-02-10 23:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Set the focus on a composer detached using the detach button (4.73 KB, patch)
2015-02-08 19:48 UTC, Robert Schroll
accepted-commit_now Details | Review

Description Jim Nelson 2015-02-05 22:53:51 UTC
To reproduce:

* Reply to a conversation.  The editor has keyboard focus.
* Press the Detach button.

In the detached composer window, nothing appears to have focus.  Pressing Tab causes the To: edit box to take focus.  I suspect focus was given to the Detach button which is hidden in the detached window, hiding the focus in the process -- but I'm not 100% on that.

What I would prefer is the focus to remain where it was at in the inline composer.
Comment 1 Robert Schroll 2015-02-05 23:03:32 UTC
Damn.  This was working at one point.
Comment 2 Robert Schroll 2015-02-08 19:48:23 UTC
Created attachment 296398 [details] [review]
Set the focus on a composer detached using the detach button

Actually, I'm no longer so sure that this used to work.  I didn't read 
carefully enough to notice that you said this only happens with the 
detach button, not with the accelerator.  I'm not sure we ever had it 
working with the detach button, for the reason you note -- once we 
realize that the detach button has been pressed, it's too late to figure 
out what used to have the focus.

But I think we can get it right 99% of the time by calling the 
set_focus() method, which puts the focus in the To box if it's empty, or 
the Subject box if it's empty, or the editor.  I don't know if we used 
to get that called when the detach button was pressed, but it isn't 
happening any more.  I put in a check if the focused widget is visible 
before we try to refocus it.  (Actually, we look at the widget's parent, 
since it's the box containing the detach button that we hide.)  The 
alternative to this would be to keep track of where the focus used to 
be, but I don't know that that's worth all the extra work.

I also took this opportunity to tighten up the focus code.  I don't know 
why I had the containers returning the focused widget, but we can figure 
it out easily directly in the composer widget itself.  If you like, I 
can split that out into a separate patch.
Comment 3 Jim Nelson 2015-02-10 22:26:03 UTC
Review of attachment 296398 [details] [review]:

Since this is a fairly simple patch, let's get the code tightening in this commit as well.  Glad to see this was so straightforward.
Comment 4 Robert Schroll 2015-02-10 23:07:11 UTC
Attachment 296398 [details] pushed as 9ec9913 - Set the focus on a composer detached using the detach button