Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_button.mm

Issue 1829393002: Add keyboard accessibility to ConstrainedWindowButton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added keyboard accessibility to ConstrainedWindowButton Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_button.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_button.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_button.mm
index 9ea5fe9033078ebe66ba7cb3255fa80418f95bd4..8a981da83f6d67f3d317a72d1fecc9b60ebee62b 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_button.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_button.mm
@@ -4,6 +4,8 @@
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
+#import <Carbon/Carbon.h> // kVK_Return.
+
#include "base/mac/scoped_nsobject.h"
#import "chrome/browser/ui/cocoa/key_equivalent_constants.h"
#include "skia/ext/skia_utils_mac.h"
@@ -245,6 +247,20 @@ void DrawBorder(const NSRect& frame,
[path stroke];
}
+- (BOOL)canBecomeKeyView {
+ return YES;
+}
+
+- (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)
Robert Sesek 2016/03/25 20:16:03 Return is not typically how buttons are invoked on
juncai 2016/03/25 20:31:54 The space works without this change to -keyDown:.
+ [self performClick:self];
+ else
+ [super keyDown:event];
+}
+
@end
@implementation ConstrainedWindowButtonCell
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698