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

Unified Diff: ui/views/controls/link.cc

Issue 1690543004: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
Index: ui/views/controls/link.cc
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc
index adbe647aaf4d8262619a736437f27da376fd18f0..f5c2dc4ab6b48b3850a7f32333779bf7fc5475f8 100644
--- a/ui/views/controls/link.cc
+++ b/ui/views/controls/link.cc
@@ -159,10 +159,17 @@ void Link::SetFontList(const gfx::FontList& font_list) {
void Link::SetText(const base::string16& text) {
Label::SetText(text);
+
+#if !defined(OS_MACOSX)
// Disable focusability for empty links. Otherwise Label::GetInsets() will
// give them an unconditional 1-px. inset on every side to allow for a focus
// border, when in this case we probably wanted zero width.
SetFocusable(!text.empty());
+#else
+ // On Mac, only allow links to have focus, when the accessibility mode is on.
tapted 2016/02/12 02:56:44 this isn't what Chrome does in the content area --
karandeepb 2016/02/22 07:15:37 As discussed, keeping the links not focusable by d
+ SetFocusable(false);
+ SetAccessibilityFocusable(!text.empty());
+#endif
}
void Link::OnNativeThemeChanged(const ui::NativeTheme* theme) {
@@ -198,9 +205,14 @@ void Link::Init() {
// Label::Init() calls SetText(), but if that's being called from Label(), our
// SetText() override will not be reached (because the constructed class is
- // only a Label at the moment, not yet a Link). So so the set_focusable()
- // call explicitly here.
+// only a Label at the moment, not yet a Link). So explicitly set focusability
+// here.
+#if !defined(OS_MACOSX)
SetFocusable(!text().empty());
+#else
+ SetFocusable(false);
+ SetAccessibilityFocusable(!text().empty());
+#endif
}
void Link::SetPressed(bool pressed) {

Powered by Google App Engine
This is Rietveld 408576698