Re: F10 and menubars
- From: "Padraig O'Briain" <Padraig Obriain sun com>
- To: gtk-devel-list gnome org, calum benson sun com
- Subject: Re: F10 and menubars
- Date: Fri, 28 Sep 2001 17:16:21 +0100 (BST)
I have spent some time looking at the source and found that a change was made to
gtkmenuitem.c by Owen Taylor on April 7th 2000 to select the first item in a
submenu when a menu item was activated.
If I understand correctly the desired behavior, from an Accessibility point of
view, when F10 is pressed is that the first menu item in the menu bar is
activated; this will cause the submenu to be displayed but the focus will remain
on the menu title in the menu bar. The effect should be the same as if the mouse
was clicked on the first menu title in the menu bar.
Below is a patch to achieve this effect.
Padraig
Index: gtkmenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenuitem.c,v
retrieving revision 1.58
diff -u -p -r1.58 gtkmenuitem.c
--- gtkmenuitem.c 2001/09/19 21:29:57 1.58
+++ gtkmenuitem.c 2001/09/28 16:11:16
@@ -647,7 +647,6 @@ static void
gtk_real_menu_item_activate_item (GtkMenuItem *menu_item)
{
GtkWidget *widget;
- GtkMenuShell *submenu;
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
@@ -671,11 +670,6 @@ gtk_real_menu_item_activate_item (GtkMen
}
gtk_menu_shell_select_item (GTK_MENU_SHELL (widget->parent), widget);
- gtk_menu_item_popup_submenu (widget);
-
- submenu = GTK_MENU_SHELL (menu_item->submenu);
- if (submenu->children)
- gtk_menu_shell_select_item (submenu, submenu->children->data);
}
}
}
Index: gtkmenu.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenu.c,v
retrieving revision 1.72
diff -u -p -r1.72 gtkmenu.c
--- gtkmenu.c 2001/08/25 03:15:26 1.72
+++ gtkmenu.c 2001/09/28 16:11:17
@@ -31,6 +31,7 @@
#include "gtklabel.h"
#include "gtkmain.h"
#include "gtkmenu.h"
+#include "gtkmenubar.h"
#include "gtkmenuitem.h"
#include "gtksignal.h"
#include "gtkwindow.h"
@@ -632,9 +633,14 @@ gtk_menu_popup (GtkMenu *menu,
/* Also, if we're popping up from a key event, select the first
* item in the menu. Bad hack, but no better way to do it
* in current menu framework.
+ *
+ * But do not select first item if the parent of the menu is a
+ * menu bar. This is to allow F10 to select first menu in menu bar
+ * without selecting first item in menu.
*/
if (current_event->type == GDK_KEY_PRESS &&
- GTK_MENU_SHELL (menu)->children)
+ GTK_MENU_SHELL (menu)->children &&
+ (!GTK_IS_MENU_BAR (parent_menu_shell)))
{
gtk_menu_shell_select_item (GTK_MENU_SHELL (menu),
GTK_MENU_SHELL (menu)->children->data);
>
> Owen Taylor wrote:
>
> > As far as highlighting menu items without selecting the submenu ...
> > I don't think it's really worth the work that it would take
> > to implement it ... it's not really a functionality thing, just
> > a cosmetic detail.
>
> There are, I believe, a couple of accessibility reasons for giving focus
> to the menu title rather than straight to the first item on the menu.
> (And likewise for subsequently giving focus to neighbouring menu titles
> as you navigate along the menu bar, until you explicitly navigate down
> into a menu).
>
> One of these is that if the menu title is given focus, then a
> screenreader will presumably just read out the menu title, whereas if an
> item on that menu is given focus instead, there's no easy way for a
> blind user to determine the name of the menu that has focus. (This, I
> assume, is why Windows and Java both give focus to menu titles rather
> than menu items when you press F10.)
>
> A screenreader could admittedly include extra functionality to work
> around this, but Bill did mention another situation where giving focus
> to the menu title is preferable. Which I've temporarily forgotten, but
> you can read it in a recent post of his to the accessibility list :o)
>
> Cheeri,
> Calum.
>
> --
> CALUM BENSON, Usability Engineer Sun Microsystems Ireland
> mailto:calum benson ireland sun com Desktop Engineering Group
> http://www.sun.ie +353 1 819 9771
>
> Any opinions are personal and not necessarily those of Sun Microsystems
>
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]