Skip to content

Commit

Permalink
AT actions API: Always expose default action at index 0.
Browse files Browse the repository at this point in the history
Nodes are expected to know if they have a default action assigned, and
return that knowledge via HasDefaultActionVerb(). We found some cases
that, nonetheless, report false incorrectly on Windows platforms.

This causes serious regressions with JAWS, so we introduce a workaround
to expose the default action unconditionally.

Bug: 1370076
Change-Id: I108ea77b267258c4d7d4f2f285824577bc2f6470
AX-relnotes: Fix enter sometimes opening context menu in JAWS.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3932984
Commit-Queue: Jacobo Aragunde Pérez <[email protected]>
Reviewed-by: Nektarios Paisios <[email protected]>
Commit-Queue: Nektarios Paisios <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1054857}
  • Loading branch information
jaragunde authored and Chromium LUCI CQ committed Oct 4, 2022
1 parent a611787 commit c287736
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2361,13 +2361,13 @@ TEST_F(BrowserAccessibilityWinTest, TestIAccessibleHyperlink) {
hyperlink.Reset();

EXPECT_HRESULT_SUCCEEDED(root_accessible->GetCOM()->nActions(&n_actions));
EXPECT_EQ(1, n_actions);
EXPECT_EQ(2, n_actions);
EXPECT_HRESULT_SUCCEEDED(div_accessible->GetCOM()->nActions(&n_actions));
EXPECT_EQ(1, n_actions);
EXPECT_EQ(2, n_actions);
EXPECT_HRESULT_SUCCEEDED(text_accessible->GetCOM()->nActions(&n_actions));
EXPECT_EQ(1, n_actions);
EXPECT_EQ(2, n_actions);
EXPECT_HRESULT_SUCCEEDED(link_accessible->GetCOM()->nActions(&n_actions));
EXPECT_EQ(1, n_actions);
EXPECT_EQ(2, n_actions);

EXPECT_HRESULT_FAILED(
root_accessible->GetCOM()->get_anchor(0, anchor.Receive()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE action_name='showContextMenu'
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE action_name='doDefault'
++ROLE_SYSTEM_LINK name='link with no href but onclick' LINKED default_action='jump' action_name='jump'
++++ROLE_SYSTEM_STATICTEXT name='link with no href but onclick' action_name='showContextMenu'
++++ROLE_SYSTEM_STATICTEXT name='link with no href but onclick' action_name='doDefault'
++ROLE_SYSTEM_LINK name='link with no href and click handler added via script' LINKED default_action='jump' action_name='jump'
++++ROLE_SYSTEM_STATICTEXT name='link with no href and click handler added via script' action_name='showContextMenu'
++++ROLE_SYSTEM_STATICTEXT name='link with no href and click handler added via script' action_name='doDefault'
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[document web] name='Action verbs' actions=(showContextMenu, scrollBackward, scrollDown, scrollForward, scrollLeft, scrollRight, scrollUp)
++[section] actions=(showContextMenu)
++++[static] name='Generic div' actions=(showContextMenu)
++[heading] name='Heading' actions=(showContextMenu)
++++[static] name='Heading' actions=(showContextMenu)
[document web] name='Action verbs' actions=(doDefault, showContextMenu, scrollBackward, scrollDown, scrollForward, scrollLeft, scrollRight, scrollUp)
++[section] actions=(doDefault, showContextMenu)
++++[static] name='Generic div' actions=(doDefault, showContextMenu)
++[heading] name='Heading' actions=(doDefault, showContextMenu)
++++[static] name='Heading' actions=(doDefault, showContextMenu)
++[push button] name='Button' actions=(press, showContextMenu)
++[link] name='Link' actions=(jump, showContextMenu)
++++[static] name='Link' actions=(showContextMenu)
++++[static] name='Link' actions=(doDefault, showContextMenu)
++[entry] selectable-text actions=(activate, showContextMenu)
++[entry] selectable-text actions=(activate, showContextMenu)
++[entry] selectable-text actions=(activate, showContextMenu)
Expand All @@ -14,18 +14,18 @@
++[check box] checked actions=(uncheck, showContextMenu) checkable:true
++[radio button] actions=(check, showContextMenu) checkable:true
++[toggle button] name='ARIA Switch' actions=(check, showContextMenu) checkable:true
++[panel] actions=(showContextMenu)
++[panel] actions=(doDefault, showContextMenu)
++++[toggle button] name='Summary' actions=(press, showContextMenu)
++++++[static] name='Summary' actions=(showContextMenu)
++++++[static] name='Summary' actions=(doDefault, showContextMenu)
++[combo box] actions=(open, showContextMenu)
++++[menu] actions=(showContextMenu)
++++[menu] actions=(doDefault, showContextMenu)
++++++[menu item] name='Pop-up button' selectable selected actions=(select, showContextMenu)
++[section] actions=(click, showContextMenu)
++++[static] name='Div with click handler' actions=(showContextMenu)
++++[static] name='Div with click handler' actions=(doDefault, showContextMenu)
++[panel] actions=(click, showContextMenu)
++++[paragraph] actions=(clickAncestor, showContextMenu)
++++++[static] name='Paragraph with click handler on parent' actions=(showContextMenu)
++[menu] actions=(showContextMenu)
++++++[static] name='Paragraph with click handler on parent' actions=(doDefault, showContextMenu)
++[menu] actions=(doDefault, showContextMenu)
++++[menu item] name='Menu item 1' actions=(select, showContextMenu)
++++[check menu item] name='Menu item 2' checked actions=(uncheck, showContextMenu) checkable:true
++++[radio menu item] name='Menu item 3' actions=(check, showContextMenu) checkable:true
Expand All @@ -37,4 +37,4 @@
++[section] actions=(click, showContextMenu)
++++[toggle button] name='ARIA switch in clickable container' actions=(check, showContextMenu) checkable:true
++++[section] actions=(clickAncestor, showContextMenu)
++++++[static] name='Generic in clickable container' actions=(showContextMenu)
++++++[static] name='Generic in clickable container' actions=(doDefault, showContextMenu)
24 changes: 12 additions & 12 deletions content/test/data/accessibility/html/action-verbs-expected-win.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ROLE_SYSTEM_DOCUMENT name='Action verbs' READONLY FOCUSABLE action_name='showContextMenu'
++IA2_ROLE_SECTION action_name='showContextMenu'
++++ROLE_SYSTEM_STATICTEXT name='Generic div' action_name='showContextMenu'
++IA2_ROLE_HEADING name='Heading' action_name='showContextMenu'
++++ROLE_SYSTEM_STATICTEXT name='Heading' action_name='showContextMenu'
ROLE_SYSTEM_DOCUMENT name='Action verbs' READONLY FOCUSABLE action_name='doDefault'
++IA2_ROLE_SECTION action_name='doDefault'
++++ROLE_SYSTEM_STATICTEXT name='Generic div' action_name='doDefault'
++IA2_ROLE_HEADING name='Heading' action_name='doDefault'
++++ROLE_SYSTEM_STATICTEXT name='Heading' action_name='doDefault'
++ROLE_SYSTEM_PUSHBUTTON name='Button' FOCUSABLE default_action='press' action_name='press'
++ROLE_SYSTEM_LINK name='Link' FOCUSABLE default_action='jump' action_name='jump'
++++ROLE_SYSTEM_STATICTEXT name='Link' action_name='showContextMenu'
++++ROLE_SYSTEM_STATICTEXT name='Link' action_name='doDefault'
++ROLE_SYSTEM_TEXT FOCUSABLE default_action='activate' action_name='activate'
++ROLE_SYSTEM_TEXT FOCUSABLE default_action='activate' action_name='activate'
++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_MULTI_LINE default_action='activate' action_name='activate'
Expand All @@ -14,16 +14,16 @@ ROLE_SYSTEM_DOCUMENT name='Action verbs' READONLY FOCUSABLE action_name='showCon
++ROLE_SYSTEM_CHECKBUTTON CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true default_action='uncheck' action_name='uncheck'
++ROLE_SYSTEM_RADIOBUTTON FOCUSABLE IA2_STATE_CHECKABLE checkable:true default_action='check' action_name='check'
++IA2_ROLE_TOGGLE_BUTTON name='ARIA Switch' FOCUSABLE IA2_STATE_CHECKABLE checkable:true default_action='check' action_name='check'
++ROLE_SYSTEM_GROUPING action_name='showContextMenu'
++ROLE_SYSTEM_GROUPING action_name='doDefault'
++++ROLE_SYSTEM_PUSHBUTTON name='Summary' COLLAPSED FOCUSABLE default_action='press' action_name='press'
++++++ROLE_SYSTEM_STATICTEXT name='Summary' action_name='showContextMenu'
++++++ROLE_SYSTEM_STATICTEXT name='Summary' action_name='doDefault'
++ROLE_SYSTEM_COMBOBOX value='Pop-up button' COLLAPSED FOCUSABLE HASPOPUP haspopup:menu default_action='open' action_name='open'
++IA2_ROLE_SECTION default_action='click' action_name='click'
++++ROLE_SYSTEM_STATICTEXT name='Div with click handler' action_name='showContextMenu'
++++ROLE_SYSTEM_STATICTEXT name='Div with click handler' action_name='doDefault'
++ROLE_SYSTEM_GROUPING default_action='click' action_name='click'
++++IA2_ROLE_PARAGRAPH default_action='click ancestor' action_name='clickAncestor'
++++++ROLE_SYSTEM_STATICTEXT name='Paragraph with click handler on parent' action_name='showContextMenu'
++ROLE_SYSTEM_MENUPOPUP action_name='showContextMenu'
++++++ROLE_SYSTEM_STATICTEXT name='Paragraph with click handler on parent' action_name='doDefault'
++ROLE_SYSTEM_MENUPOPUP action_name='doDefault'
++++ROLE_SYSTEM_MENUITEM name='Menu item 1' default_action='select' action_name='select'
++++IA2_ROLE_CHECK_MENU_ITEM name='Menu item 2' CHECKED IA2_STATE_CHECKABLE checkable:true default_action='uncheck' action_name='uncheck'
++++IA2_ROLE_RADIO_MENU_ITEM name='Menu item 3' IA2_STATE_CHECKABLE checkable:true default_action='check' action_name='check'
Expand All @@ -35,4 +35,4 @@ ROLE_SYSTEM_DOCUMENT name='Action verbs' READONLY FOCUSABLE action_name='showCon
++IA2_ROLE_SECTION default_action='click' action_name='click'
++++IA2_ROLE_TOGGLE_BUTTON name='ARIA switch in clickable container' IA2_STATE_CHECKABLE checkable:true default_action='check' action_name='check'
++++IA2_ROLE_SECTION default_action='click ancestor' action_name='clickAncestor'
++++++ROLE_SYSTEM_STATICTEXT name='Generic in clickable container' action_name='showContextMenu'
++++++ROLE_SYSTEM_STATICTEXT name='Generic in clickable container' action_name='doDefault'
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,9 @@ TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkActionGetNActionsNoActions) {

gint number_of_actions = atk_action_get_n_actions(ATK_ACTION(root_obj));

// The only action exposed would be the context menu action.
EXPECT_EQ(1, number_of_actions);
// In absence of any other actions, we would expose the default and the
// context menu actions.
EXPECT_EQ(2, number_of_actions);

g_object_unref(root_obj);
}
Expand Down
7 changes: 4 additions & 3 deletions ui/accessibility/platform/ax_platform_node_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ std::vector<ax::mojom::Action> AXPlatformNodeDelegate::GetSupportedActions()
ax::mojom::Action::kScrollBackward});
std::vector<ax::mojom::Action> supported_actions;

// The default action, if it exists, must be listed at index 0.
if (HasDefaultActionVerb())
supported_actions.push_back(ax::mojom::Action::kDoDefault);
// The default action must be listed at index 0.
// TODO(crbug.com/1370076): Find out why some nodes do not expose a
// default action (HasDefaultActionVerb() is false).
supported_actions.push_back(ax::mojom::Action::kDoDefault);

// Users expect to be able to bring a context menu on any object via e.g.
// right click, so we make the context menu action available to any object
Expand Down

0 comments on commit c287736

Please sign in to comment.