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

Unified Diff: ui/views/accessibility/native_view_accessibility_unittest.cc

Issue 2119413004: a11y: Exclude children of nested keyboard accessible controls from a11y tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 4 years, 1 month 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/accessibility/native_view_accessibility_unittest.cc
diff --git a/ui/views/accessibility/native_view_accessibility_unittest.cc b/ui/views/accessibility/native_view_accessibility_unittest.cc
index c75ae19e1d3ce103c3c77b5b02647d47da023cb0..cfe083ea8fcbaf1a6c307e7655585c3d6db53173 100644
--- a/ui/views/accessibility/native_view_accessibility_unittest.cc
+++ b/ui/views/accessibility/native_view_accessibility_unittest.cc
@@ -70,6 +70,16 @@ class NativeViewAccessibilityTest : public ViewsTestBase {
TEST_F(NativeViewAccessibilityTest, RoleShouldMatch) {
EXPECT_EQ(ui::AX_ROLE_BUTTON, button_accessibility_->GetData().role);
+#if defined(OS_MACOSX)
dmazzoni 2016/11/30 23:12:44 I'm okay with removing this test or rewriting it t
Patti Lor 2016/12/01 01:12:07 Will go ahead and do this if it's decided we'll go
+ // On Mac, the label isn't given a role. Since it's a subview of |button_|
+ // (and the button is focusable), the label is assumed to form part of the
+ // button and not have a role of its own.
+ EXPECT_EQ(ui::AX_ROLE_UNKNOWN, label_accessibility_->GetData().role);
+ // This will happen for all potentially keyboard-focusable Views with
+ // non-keyboard-focusable children, so if we make the button unfocusable, the
+ // label will be allowed to have its own role again.
+ button_->SetFocusBehavior(View::FocusBehavior::NEVER);
+#endif
EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, label_accessibility_->GetData().role);
}

Powered by Google App Engine
This is Rietveld 408576698