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 53709 - KEYNAV: GtkButton
KEYNAV: GtkButton
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: Other
2.5.x
Other All
: High enhancement
: Small fix
Assigned To: gtk-bugs
gtk-bugs
AP3
: 73431 (view as bug list)
Depends on:
Blocks: 69569
 
 
Reported: 2001-04-26 18:34 UTC by Calum Benson
Modified: 2007-01-06 03:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch that fixes: "If the current control doesn't accept keyboard input , then mnemonics should be accessible without the Alt key" (2.93 KB, patch)
2002-05-10 04:46 UTC, Pasupathi
none Details | Review
My version of patch (5.20 KB, patch)
2004-03-11 22:42 UTC, Owen Taylor
none Details | Review
Another proposed patch. (1.82 KB, patch)
2004-10-31 18:32 UTC, Christian Neumair
committed Details | Review

Description Calum Benson 2001-04-26 18:34:02 UTC
If a GtkButton shares the same mnemonic as another control in the same
context, the button should not be activated when it is given focus by using
that mnemonic.  In this case, activation should need to be done explicitly
by pressing Spacebar when the button has focus.

(This is an instance of the general behaviour recommended for Gtk 2.0 for
clashing mnemonics-- repeatedly pressing that mnemonic should cycle focus
through all widgets that share the mnemonic, but not activate any of them).

When a GtkButton has focus, Spacebar should activate it.  Pressing Enter
should always activate the window's default button if it has one, or do
nothing if it doesn't have one, regardless of which control currently has
focus (be it a GtkButton or not).  The only exception to this is when the
control that does have focus over-rides Enter for its own purposes, e.g. a
multi-line text field.

When a control that doesn't accept keyboard input has focus (e.g.
textfields, buttons, tree/list-derived widgets), it would be nice if all
mnemonics in that the current context were active whether or not the Alt
key was held at the same time.  At the very least, though, in any message
box, it should be posisble to select any of the command buttons just by
pressing the underlined character on any of those buttons, unmodified.

[Check http://developer.gnome.org/projects/gap/keyboardnav.html for any
later proposals that may not yet have filtered through to this bug report]
Comment 1 Calum Benson 2001-08-03 10:29:06 UTC
>Pressing Enter should always activate the window's default button if
>it has one, or do nothing if it doesn't have one, regardless of which
>control currently has focus

NB This is still open to debate, and is currently being discussed on
gnome-accessibility-list and gtk-devel-list.
Comment 2 Luis Villa 2002-01-22 21:29:52 UTC
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.
Comment 3 Owen Taylor 2002-02-28 20:08:38 UTC
Put on the 2.2 milestone for the issue of whether the default
should move to the currently focused button.
Comment 4 Pasupathi 2002-05-10 04:46:28 UTC
Created attachment 8333 [details] [review]
patch that fixes: "If the current control doesn't accept keyboard input , then mnemonics should be accessible without the Alt key"
Comment 5 Calum Benson 2002-10-24 18:58:35 UTC
Owen, what's the status of Pasu's patch, have you ever reviewed it?  
If it's acceptable I think it's really worth consideration for 
2.2... Windows already offers this functionality and it's very 
useful for dismissing alerts and navigating simple dialogs.  (And 
it's orthogonal to the default button debate that the rest of this 
bug is concerned with).
Comment 6 Calum Benson 2003-06-25 23:25:35 UTC
Marking AP3 to reflect a11y team's assessment of a11y impact.
Comment 7 Owen Taylor 2003-07-03 13:41:17 UTC
Bumping up the priority to make sure I look at the patch before
2.4.
Comment 8 Calum Benson 2003-08-07 16:09:04 UTC
Apologies for spam... marking as GNOMEVER2.3 so it appears on the official GNOME
bug list :)
Comment 9 Owen Taylor 2004-03-11 22:41:22 UTC
Issues with the patch:

 - For GTK+-2.4, we've exported all the internals of 
   gtk_window_key_press() so someone can provide their
   own customized behavior. This introduces private parts
   of gtk_window_key_press() again unless we make more
   API additions. (Which we can't do at this point)

   Of course, customized key press handlers wouldn't work
   any worse than they did without the change, just less
   consistently with other GTK+ windows

 - The patch hardcodes GDK_MOD1_MASK 

 - There is a bunch of code duplicated between activate_key
   and activate_key_without_modifiers.

 - I think this handling should be after *everything* else,
   include the binding set for the toplevel window;
   even so, there is potential for breakage, because 
   an application might have connected to the window
   with g_signal_connect_after().

I'm going to attach a version of the patch with most of the
above issues cleaned up; it does make things feel a lot
nicer. 

The g_signal_connect_after() issue means however that it probably 
can't go in until GTK+-2.6. (Even then, it's a bit of a scary
quasi-incompatible change, but at least we have some time to
see how much it breaks...)
Comment 10 Owen Taylor 2004-03-11 22:42:04 UTC
Created attachment 25545 [details] [review]
My version of patch
Comment 11 Luis Villa 2004-04-29 14:15:45 UTC
Comment on attachment 8333 [details] [review]
patch that fixes: "If the current control doesn't accept keyboard input , then mnemonics should be accessible without the Alt key"

Obsoleted by Owen's patch, marking as such.
Comment 12 Calum Benson 2004-10-21 16:44:21 UTC
Apologies for spam-- ensuring Sun a11y team are cc'ed on all current a11y bugs.
 Filter on "SUN A11Y SPAM" to ignore.
Comment 13 Christian Neumair 2004-10-31 18:32:34 UTC
Created attachment 33291 [details] [review]
Another proposed patch.

Here is another proposed patch.
Owen: I'm not sure whether it is useful to handle this in the window class,
since it only seems to affect message dialogs. My implementation does it
directly in the message dialog class and has way less LOC. testgtk seems to
like it.
Comment 14 Owen Taylor 2004-11-01 15:28:14 UTC
The behavior should apply to *any*
window without editable text fields, not just ones that happen to be
implemented as a GtkMessageDialog.

Though I have trouble remembering my patch 6 months later, I think it was
basically OK, except that it was blocked by the 2.4 API freeze. I think
we should be be able to commit it now for 2.6.

Comment 15 Matthias Clasen 2004-11-02 13:26:27 UTC
2004-11-02  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkwindow.c (gtk_window_activate_key_after): As
	a last stage in GtkWindow key press handing, try adding
	window->mnemonic_modifier to event->state and see if it
	matches a mnemonic. (#53709, based on a patch by
	Pasupathi Duraisamy, patch by Owen Taylor)
Comment 16 Christian Persch 2004-11-06 20:34:29 UTC
This change broke Epiphany's typeahead find:

Steps to reproduce:
0) Start epiphany, load a page
1) Type 'F' (or '/F', if you disabled typeaheadfind autostart)

This will search for 'F' but also open the File menu.
Comment 17 Owen Taylor 2004-11-06 21:17:36 UTC
Well, that's clearly a Epiphany bug. If you consume a keystroke, you have
to return TRUE from your key press handler to indicate that.

But it might indicate that this change isn't sufficiently compatible :-((
Comment 18 Christian Persch 2004-11-06 21:37:14 UTC
I should have said, more precisely, that this broke mozilla's typeaheadfind,
when embedded in Epiphany. Epiphany doesn't do anything here. I'm going to try
to find the cause in mozilla code.

> But it might indicate that this change isn't sufficiently compatible :-((

Yes.
Comment 19 Alexey Morozov 2004-11-23 17:02:39 UTC
Take a look at https://bugzilla.mozilla.org/show_bug.cgi?id=268171
Comment 20 Matthias Clasen 2004-12-22 21:20:20 UTC
*** Bug 73431 has been marked as a duplicate of this bug. ***
Comment 21 Calum Benson 2006-04-26 17:11:57 UTC
Apologies for spam... ensuring Sun a11y folks are cc'ed on all current accessibility bugs.
Comment 22 Matthias Clasen 2007-01-06 03:39:21 UTC
The mozilla problem has been fixed in the meantime. Closing this.