summaryrefslogtreecommitdiffstats
path: root/ui/views
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-21 04:48:30 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-21 04:48:30 +0000
commit60398107991dec424d57f348d45b66fea4fa3cc8 (patch)
treed816d9c69c5ec8c2a724cf1404f470612f190a11 /ui/views
parent4f9c79ec0b34bd97b8bd86077692b24a412bbdf0 (diff)
downloadchromium_src-60398107991dec424d57f348d45b66fea4fa3cc8.zip
chromium_src-60398107991dec424d57f348d45b66fea4fa3cc8.tar.gz
chromium_src-60398107991dec424d57f348d45b66fea4fa3cc8.tar.bz2
The Wrench menu in Chrome desktop AURA when displayed using the keyboard via the Alt down key combination displays
again after being dismissed. This is an AURA specific issue which occurs because the menu button returns false from the MenuButton::OnKeyPressed function in this case. This works correctly on non AURA chrome because we eventually return to the message handler in the WNDPROC and return from there. In AURA the event handling code dispatches the event to the focused target if it is unhandled leading to the problem. Fix is to return true from the MenuButton::OnKeyPressed function for AURA Chrome. BUG=222458 TEST=Covered by interactive ui test for Windows KeyboardAccessTest.TestMenuKeyboardOpenDismiss Review URL: https://codereview.chromium.org/12780026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r--ui/views/controls/button/menu_button.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc
index b770a64..1f0bfb9 100644
--- a/ui/views/controls/button/menu_button.cc
+++ b/ui/views/controls/button/menu_button.cc
@@ -238,7 +238,16 @@ bool MenuButton::OnKeyPressed(const ui::KeyEvent& event) {
case ui::VKEY_UP:
case ui::VKEY_DOWN: {
// WARNING: we may have been deleted by the time Activate returns.
- return Activate();
+ bool ret = Activate();
+#if defined(USE_AURA)
+ // This is to prevent the keyboard event from being dispatched twice.
+ // The Activate function returns false in most cases. In AURA if the
+ // keyboard event is not handled, we pass it to the default handler
+ // which dispatches the event back to us causing the menu to get
+ // displayed again.
+ ret = true;
+#endif
+ return ret;
}
default:
break;