GNOME Bugzilla – Bug 53579
KEYNAV: GtkCombo
Last modified: 2011-02-04 16:11:52 UTC
When the input field of a dropdown combo box has focus and the list is not currently displayed, pressing Alt+down arrow should drop down the list. (Currently this is done by pressing Enter). If the current contents of the entry field match an entry in the list, that list entry should be given focus. Otherwise no entry in the list should be given focus until you press the down arrow a second time. The keyboard focus within the list should be changeable by using: - up and down arrow keys to select previous and next entry respectively - PageUp to select the top item currently visible, then the top item on the previous "page" if pressed again - PageDn to select the bottom item currently visible, then the bottom item on the next "page" if pressed again - Home and End to select the first and last item in list respectively - Typing any printable character to select the next item in the list starting with that character. (Should ideally work with "select the next item in the list starting with the 'n' characters I just typed", too, as MS Windows does. But that's more work as it would require a global timeout setting which would have to be adjustable somewhere to cope with people who can only type slowly-- which is something Windows doesn't provide, I don't think). While the list is being displayed, pressing Enter should select the currently-focused item and hide the list, leaving keyboard focus on the combo box's entry field. (If the list is rolled up, pressing Enter should activate the default button in the window, if there is one, otherwise do nothing.) The user's currently-enforced cut, copy and paste keyboard accelerators should be supported in the input field. [Check http://developer.gnome.org/projects/gap/keyboardnav.html for any later proposals that may not have filtered through to this bug report yet]
GtkCombo, which uses GtkList, a deprecated widget, for the list, will be replaced in GTK+-2.2. The only thing which could be addressed at this point is implementing Alt+down arrow to drop down the list. The focus changing works as requested except that Home and End keys are defined as keybindings on the list item and do horizontal scrolling.
Dropping down the list of a combo when the entry field has focus is implemented by a signal handler on the "activate" signal on the entry field; the entry field has "activates-default" set to FALSE. Reimplementing dropping down the list on Alt+down arrow is best left to the replacement for GtkCombo.
Adding GNOME2 keyword to all keynav bugs per sander's request. You can filter on the phrase 'luis doing GNOME2 work' to catch all instances of this so that you can ignore them.
*** Bug 70202 has been marked as a duplicate of this bug. ***
I have fixed some of the keynav problems existing with Gtkcombo. I will attach a patch which has the following implemented for gtkcombo: a) Implemented Ctrl+Down for dropping down the list. b) Implement Ctrl+Up for rolling up the list. c) Sound a system beep when the user tries to navigate past the first/last entries in the list with Up/Down arrow keys without dropping down the list.
Created attachment 7497 [details] [review] Patch provides fixes for some keynav problems in gtkcombo.
Please apply the patch(id=7497) with the following version of file(s): gtkcombo.c - 1.64
For future reference when the rewrite happens, you probably also ought to be able to select an item in the dropdown list by pressing Spacebar in addition to Return.
Bill has just indicated his concerne to me that we're not making at least the latter change now (Spacebar to select an item from the list), even though the widget is due to be deprecated soon... he feels the behaviour is sufficiently inconsistent with the other widgets to be a potential problem, and that we should be starting to address these sorts of issues now that we're post-2.0 rather than having to wait for the new widget to come along. Is there any chance this could be addressed sometime soon?
See also bug #90109
*** Bug 90109 has been marked as a duplicate of this bug. ***
Moving back to the 2.2 milestone since I was doing some bug fixage on GtkCombo anyways.
Keynav behavior now: * When focus is on entry, Alt-Down or (when not disabled via the API) Return/Enter pop down the list. * When focus is on entry, arrow keys move always move selection subject to to gtk_combo_set_use_arrows(). [Defaults to TRUE] * When list is popped down, arrow keys move selection, but do *not* change contents of the entry. * Return updates the contents of the entry and closes the dropdown. * Space updates the contents of the entry but does not close the dropdown. * Escape/Alt-Up close the drop down without updating the entry. This is reasonably close to what Windows/Qt/Mozilla do though it doesn't correspond exactly to any of them. (And Mozilla and probably windows are internally inconsistent) Differences from the keynav spec: * I went with the standard Alt-Down/Alt-Up instead of Control, since it doesn't seem parallel to the notebook case to me, so I figured being consistent with other platforms was better. * Space doesn't close the dropdown (behavior is like GtkMenu, in drop down combos on other platforms, space does nothing, but I think an immediate update of the control is useful) * No beep. (We don't beep elsewhere, so adding it here seemed pointless) The keynav is still do ad-hoc rather than GtkBindingSet, fixing that would be really hard and GtkCombo will be replaced a anyways. Wed Nov 13 17:03:19 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkcombo.c: Change so that updates of selection don't take effect immediately, but only when popdown is closed with a button release within the combo or Return/Enter. * gtk/gtkcombo.c: Support Alt-Down to pop down the combo, Alt-Up to pop it back up, Space to immediately select current item. * gtk/gtkcombo.c (gtk_combo_entry_key_press): Don't move the focus when we get to the ends of the list entries. * gtk/gtkcombo.c: Fix handling of state in ad-hoc keybinding handling to be a bit more reasonable. * gtk/gtkcombo.c (gtk_combo_init): Make gtk_combo_set_use_arrows_always, enable_arrows_always properties do nothing, they were an awful idea. Always behave as if enable_arrows_always is true.