Commit 7286b9d0 authored by noms's avatar noms Committed by Commit bot

[Mac] Allow "Enter" to activate the buttons in the new avatar bubble.

Despite this not being the OSX way, users are complaining that Enter doesn't
activate the buttons in the menu, because it used to. I think the easiest
way is to wrap all buttons in a view that responds to Enter, and activates
the button accordingly.

BUG=454467
TEST=Start Chrome with --enable-new-avatar-menu. Open the avatar bubble and
tab through items. Pressing enter should perform the button's action.

Review URL: https://codereview.chromium.org/890143005

Cr-Commit-Position: refs/heads/master@{#314265}
parent e52332e1
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h> // kVK_Return.
#import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
......@@ -788,6 +789,16 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
[[self cell] setBackgroundColor:backgroundColor];
}
-(void)keyDown:(NSEvent*)event {
// Since there is no default button in the bubble, it is safe to activate
// all buttons on Enter as well, and be consistent with the Windows
// implementation.
if ([event keyCode] == kVK_Return)
[self performClick:self];
else
[super keyDown:event];
}
- (BOOL)canBecomeKeyView {
return YES;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment