Skip to content

Commit

Permalink
Do not expose ROLE_SYSTEM_WINDOW for our root object
Browse files Browse the repository at this point in the history
Do not return ROLE_SYSTEM_WINDOW ourselves as that is a special MSAA
system role used to indicate a real native window object. It is
automatically created by oleacc.dll as a parent of the root of our
hierarchy, matching the HWND.

For AX_ROLE_WINDOW, we should expose something similar to what Firefox
exposes, namely ROLE_SYSTEM_APPLICATION.

This helps NVDA not read superfluous text when the user navigates
to the toolbar or location bar.

Bug: 794931
Change-Id: I123f07cb477304da1f016d65ea8c2b23b7a92ef4
Reviewed-on: https://chromium-review.googlesource.com/826866
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524102}
  • Loading branch information
aleventhal authored and Commit Bot committed Dec 14, 2017
1 parent 6e4b9bd commit 51332db
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ui/accessibility/platform/ax_platform_node_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2914,7 +2914,11 @@ int AXPlatformNodeWin::MSAARole() {
return ROLE_SYSTEM_GROUPING;

case AX_ROLE_WINDOW:
return ROLE_SYSTEM_WINDOW;
// Do not return ROLE_SYSTEM_WINDOW as that is a special MSAA system role
// used to indicate a real native window object. It is automatically
// created by oleacc.dll as a parent of the root of our hierarchy,
// matching the HWND.
return ROLE_SYSTEM_APPLICATION;

// TODO(dmazzoni): figure out the proper MSAA role for roles listed below.
case AX_ROLE_BLOCKQUOTE:
Expand Down
17 changes: 17 additions & 0 deletions ui/views/accessibility/native_view_accessibility_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,22 @@ TEST_F(NativeViewAccessibilityWinTest, GetAllOwnedWidgetsCrash) {
EXPECT_EQ(1L, child_count);
}

TEST_F(NativeViewAccessibilityWinTest, WindowHasRoleApplication) {
// We expect that our internal window object does not expose
// ROLE_SYSTEM_WINDOW, but ROLE_SYSTEM_APPLICATION instead.
Widget widget;
Widget::InitParams init_params =
CreateParams(Widget::InitParams::TYPE_WINDOW);
init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget.Init(init_params);

ComPtr<IAccessible> accessible(
widget.GetRootView()->GetNativeViewAccessible());
ScopedVariant childid_self(CHILDID_SELF);
ScopedVariant role;
EXPECT_EQ(S_OK, accessible->get_accRole(childid_self, role.Receive()));
EXPECT_EQ(role.type(), VT_I4);
EXPECT_EQ(V_I4(role.ptr()), ROLE_SYSTEM_APPLICATION);
}
} // namespace test
} // namespace views

0 comments on commit 51332db

Please sign in to comment.