Commit 0807e0a0 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Use consistent role for options in a select size=1

Sometimes the menuitem role was incorrectly exposed for the role of
<option> elements in a <select size=1> depending on which ancestors
were ignored. These elements should always be exposed as listitems.

The code that does this was intended to be removed as part of a
previous refactoring. This removes it now.

to screen readers as menuitems instead of listitems (Windows only)

AX-RelNotes: in rare cases, select drop down options were reported
Bug: 1114273
Change-Id: I618a883912cca5809661d919bbb48cfdc355e3d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2369252
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801432}
parent 0776b10e
...@@ -3,4 +3,4 @@ Document ...@@ -3,4 +3,4 @@ Document
++++Text Name='The dialog subtree should be the only text content in the accessibility tree. ' ++++Text Name='The dialog subtree should be the only text content in the accessibility tree. '
++++Hyperlink Name='Link inside the dialog.' ++++Hyperlink Name='Link inside the dialog.'
++++++Text Name='Link inside the dialog.' IsControlElement=false ++++++Text Name='Link inside the dialog.' IsControlElement=false
++Menu IsControlElement=false Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false ++List IsControlElement=false Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false
\ No newline at end of file \ No newline at end of file
...@@ -3,4 +3,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ...@@ -3,4 +3,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++++ROLE_SYSTEM_STATICTEXT name='The dialog subtree should be the only text content in the accessibility tree. ' ++++ROLE_SYSTEM_STATICTEXT name='The dialog subtree should be the only text content in the accessibility tree. '
++++ROLE_SYSTEM_LINK name='Link inside the dialog.' FOCUSABLE ++++ROLE_SYSTEM_LINK name='Link inside the dialog.' FOCUSABLE
++++++ROLE_SYSTEM_STATICTEXT name='Link inside the dialog.' ++++++ROLE_SYSTEM_STATICTEXT name='Link inside the dialog.'
++ROLE_SYSTEM_MENUPOPUP INVISIBLE ++ROLE_SYSTEM_LIST INVISIBLE
\ No newline at end of file \ No newline at end of file
Document Document
++Menu IsControlElement=false Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false ++List IsControlElement=false Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false
++Pane IsControlElement=false Window.IsModal=true ++Pane IsControlElement=false Window.IsModal=true
++++Text Name='This is the now active dialog. Of course it should be in the tree. ' ++++Text Name='This is the now active dialog. Of course it should be in the tree. '
++++Button Name='This is in the active dialog and should be in the tree.' ++++Button Name='This is in the active dialog and should be in the tree.'
\ No newline at end of file
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++ROLE_SYSTEM_MENUPOPUP INVISIBLE ++ROLE_SYSTEM_LIST INVISIBLE
++ROLE_SYSTEM_DIALOG IA2_STATE_MODAL ++ROLE_SYSTEM_DIALOG IA2_STATE_MODAL
++++ROLE_SYSTEM_STATICTEXT name='This is the now active dialog. Of course it should be in the tree. ' ++++ROLE_SYSTEM_STATICTEXT name='This is the now active dialog. Of course it should be in the tree. '
++++ROLE_SYSTEM_PUSHBUTTON name='This is in the active dialog and should be in the tree.' FOCUSABLE ++++ROLE_SYSTEM_PUSHBUTTON name='This is in the active dialog and should be in the tree.' FOCUSABLE
\ No newline at end of file
...@@ -5321,14 +5321,10 @@ int AXPlatformNodeWin::MSAARole() { ...@@ -5321,14 +5321,10 @@ int AXPlatformNodeWin::MSAARole() {
return ROLE_SYSTEM_MENUITEM; return ROLE_SYSTEM_MENUITEM;
case ax::mojom::Role::kMenuListPopup: case ax::mojom::Role::kMenuListPopup:
if (IsAncestorComboBox()) return ROLE_SYSTEM_LIST;
return ROLE_SYSTEM_LIST;
return ROLE_SYSTEM_MENUPOPUP;
case ax::mojom::Role::kMenuListOption: case ax::mojom::Role::kMenuListOption:
if (IsAncestorComboBox()) return ROLE_SYSTEM_LISTITEM;
return ROLE_SYSTEM_LISTITEM;
return ROLE_SYSTEM_MENUITEM;
case ax::mojom::Role::kMeter: case ax::mojom::Role::kMeter:
return ROLE_SYSTEM_PROGRESSBAR; return ROLE_SYSTEM_PROGRESSBAR;
...@@ -6152,14 +6148,10 @@ base::string16 AXPlatformNodeWin::UIAAriaRole() { ...@@ -6152,14 +6148,10 @@ base::string16 AXPlatformNodeWin::UIAAriaRole() {
return L"menuitemradio"; return L"menuitemradio";
case ax::mojom::Role::kMenuListPopup: case ax::mojom::Role::kMenuListPopup:
if (IsAncestorComboBox()) return L"list";
return L"list";
return L"menu";
case ax::mojom::Role::kMenuListOption: case ax::mojom::Role::kMenuListOption:
if (IsAncestorComboBox()) return L"listitem";
return L"listitem";
return L"menuitem";
case ax::mojom::Role::kMeter: case ax::mojom::Role::kMeter:
return L"progressbar"; return L"progressbar";
...@@ -6818,14 +6810,10 @@ LONG AXPlatformNodeWin::ComputeUIAControlType() { // NOLINT(runtime/int) ...@@ -6818,14 +6810,10 @@ LONG AXPlatformNodeWin::ComputeUIAControlType() { // NOLINT(runtime/int)
return UIA_RadioButtonControlTypeId; return UIA_RadioButtonControlTypeId;
case ax::mojom::Role::kMenuListPopup: case ax::mojom::Role::kMenuListPopup:
if (IsAncestorComboBox()) return UIA_ListControlTypeId;
return UIA_ListControlTypeId;
return UIA_MenuControlTypeId;
case ax::mojom::Role::kMenuListOption: case ax::mojom::Role::kMenuListOption:
if (IsAncestorComboBox()) return UIA_ListItemControlTypeId;
return UIA_ListItemControlTypeId;
return UIA_MenuItemControlTypeId;
case ax::mojom::Role::kMeter: case ax::mojom::Role::kMeter:
return UIA_ProgressBarControlTypeId; return UIA_ProgressBarControlTypeId;
...@@ -7808,18 +7796,6 @@ HRESULT AXPlatformNodeWin::AllocateComArrayFromVector( ...@@ -7808,18 +7796,6 @@ HRESULT AXPlatformNodeWin::AllocateComArrayFromVector(
return S_OK; return S_OK;
} }
// TODO(dmazzoni): Remove this function once combo box refactoring is
// complete.
bool AXPlatformNodeWin::IsAncestorComboBox() {
auto* parent =
static_cast<AXPlatformNodeWin*>(FromNativeViewAccessible(GetParent()));
if (!parent)
return false;
if (parent->MSAARole() == ROLE_SYSTEM_COMBOBOX)
return true;
return parent->IsAncestorComboBox();
}
bool AXPlatformNodeWin::IsPlaceholderText() const { bool AXPlatformNodeWin::IsPlaceholderText() const {
if (GetData().role != ax::mojom::Role::kStaticText) if (GetData().role != ax::mojom::Role::kStaticText)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment