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 765551 - When searching, pressing 'spacebar' selects the file
When searching, pressing 'spacebar' selects the file
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.22.x
Other All
: Normal major
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
: 773193 775544 (view as bug list)
Depends on:
Blocks: 775544
 
 
Reported: 2016-04-25 16:48 UTC by Luis Henrique Mello
Modified: 2018-05-02 17:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Luis Henrique Mello 2016-04-25 16:48:12 UTC
When filtering files by typing, pressing 'spacebar' opens the selected file - as if 'Enter' was pressed. So it's not possible to search for a file that has spaces in its name.
Comment 1 Luis Henrique Mello 2017-05-18 21:44:59 UTC
I just noticed why this happens: if you press a key or click the search button the file list is still active, when the cursor should be shifted to the search bar. If you click on the search bar then you can press the space key without selecting a file.
Comment 2 Daniel Boles 2017-08-15 00:58:22 UTC
Confirmed. Seems inadvisable IMHO.

Anyway, this is deliberately coded in gtkfilechooserwidget.c:

  if ((event->keyval == GDK_KEY_Return
       || event->keyval == GDK_KEY_ISO_Enter
       || event->keyval == GDK_KEY_KP_Enter
       || event->keyval == GDK_KEY_space
       || event->keyval == GDK_KEY_KP_Space)
      && !(event->state & gtk_accelerator_get_default_mod_mask ())
      && !(priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
           priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
    { /* Activate default widget of FCW's toplevel */ }
Comment 3 Luis Henrique Mello 2017-08-15 10:00:22 UTC
(In reply to Daniel Boles from comment #2)
> Confirmed. Seems inadvisable IMHO.
> 
> Anyway, this is deliberately coded in gtkfilechooserwidget.c:
> 
>   if ((event->keyval == GDK_KEY_Return
>        || event->keyval == GDK_KEY_ISO_Enter
>        || event->keyval == GDK_KEY_KP_Enter
>        || event->keyval == GDK_KEY_space
>        || event->keyval == GDK_KEY_KP_Space)
>       && !(event->state & gtk_accelerator_get_default_mod_mask ())
>       && !(priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
>            priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
>     { /* Activate default widget of FCW's toplevel */ }

Yes, but why space?

Removing these lines should fix this:

       || event->keyval == GDK_KEY_space
       || event->keyval == GDK_KEY_KP_Space)
Comment 4 Daniel Boles 2017-08-15 10:27:32 UTC
Yes, it's obvious how to fix it. The question is whether the maintainers will want to.
Comment 5 Daniel Boles 2017-08-15 10:43:55 UTC
...fwiw, my opinion is that it should be fixed; the Return/Enter set give enough shortcuts that stealing Space for the same purpose is not justifiable, compared to what it loses.
Comment 6 Daniel Boles 2017-08-25 02:25:33 UTC
*** Bug 775544 has been marked as a duplicate of this bug. ***
Comment 7 Daniel Boles 2017-10-06 16:14:06 UTC
*** Bug 773193 has been marked as a duplicate of this bug. ***
Comment 8 Liquider 2017-10-12 14:31:38 UTC
> Return/Enter set give enough shortcuts that stealing Space for the same purpose is not justifiable

:+1:

Space should activate the focused/default widget only when not in an input field
Comment 9 Daniel Boles 2017-10-12 14:34:55 UTC
The problem is that the focus is *not* in the input field, but rather it's on the main content area of the FileChooser, and that just happens to redirect keys other than Space et al. to search and populate the input field.
Comment 10 GNOME Infrastructure Team 2018-05-02 17:04:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/616.