Commit 14e1e7da authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Update a11y mapping of <menu>

The <menu> tag is no longer supported as an interactive feature, but
is still supported as a semantic tag. The HTML spec still includes it
as a container for <li> children, but has removed <menuitem>.

Another option would be to try and be "clever" and look for
role=menuitem children, changing the mapping to menu. However, given
the state of the standard and varying browser support, it seems better
to not add extra complexity and also to not encourage usage.

Decisions:
- Support simple mapping to the list role, because if it's just used
semantically, it will be confusing for users who reach te menu and
it does not act like one.
- Remove behavior where child buttons/radios/checkboxes are mapped
to menuitemfoo roles when inside a menu. There is nothing spec'd in
HTML-AAM or CORE-AAM for either of these conditions, and it looks like
more strange menu code that was inherited from WebKit.

This CL will make it easier to support an upcoming CL that cleans
up radio button code.

Bug: None
Change-Id: I49e95b5e526e742102b0bb6ad92b17f7a4ba0175
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2543685Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828978}
parent 9f774202
...@@ -1740,11 +1740,6 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityInputButton) { ...@@ -1740,11 +1740,6 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityInputButton) {
RunHtmlTest(FILE_PATH_LITERAL("input-button.html")); RunHtmlTest(FILE_PATH_LITERAL("input-button.html"));
} }
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest,
AccessibilityInputButtonInMenu) {
RunHtmlTest(FILE_PATH_LITERAL("input-button-in-menu.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityInputCheckBox) { IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityInputCheckBox) {
RunHtmlTest(FILE_PATH_LITERAL("input-checkbox.html")); RunHtmlTest(FILE_PATH_LITERAL("input-checkbox.html"));
} }
...@@ -1832,11 +1827,6 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityInputImage) { ...@@ -1832,11 +1827,6 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityInputImage) {
RunHtmlTest(FILE_PATH_LITERAL("input-image.html")); RunHtmlTest(FILE_PATH_LITERAL("input-image.html"));
} }
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest,
AccessibilityInputImageButtonInMenu) {
RunHtmlTest(FILE_PATH_LITERAL("input-image-button-in-menu.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityInputList) { IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityInputList) {
RunHtmlTest(FILE_PATH_LITERAL("input-list.html")); RunHtmlTest(FILE_PATH_LITERAL("input-list.html"));
} }
...@@ -2069,9 +2059,8 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityMath) { ...@@ -2069,9 +2059,8 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityMath) {
RunHtmlTest(FILE_PATH_LITERAL("math.html")); RunHtmlTest(FILE_PATH_LITERAL("math.html"));
} }
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityMenu) {
AccessibilityMenutypecontext) { RunHtmlTest(FILE_PATH_LITERAL("menu.html"));
RunHtmlTest(FILE_PATH_LITERAL("menu-type-context.html"));
} }
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityMeta) { IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityMeta) {
......
android.webkit.WebView focusable focused scrollable
++android.view.View
++++android.view.MenuItem role_description='menu item' clickable focusable name='Button in menu element'
++android.view.View role_description='menu'
++++android.view.MenuItem role_description='menu item' clickable focusable name='Button in element with menu role'
\ No newline at end of file
[document web]
++[section]
++++[menu item] name='Button in menu element'
++[menu] vertical xml-roles:menu
++++[menu item] name='Button in element with menu role'
rootWebArea
++genericContainer ignored
++++genericContainer ignored
++++++genericContainer
++++++++menuItem inputType='button' name='Button in menu element'
++++++menu
++++++++menuItem inputType='button' name='Button in element with menu role'
Document
++Group IsControlElement=false
++++MenuItem Name='Button in menu element'
++Menu Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false
++++MenuItem Name='Button in element with menu role'
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
++++ROLE_SYSTEM_MENUITEM name='Button in menu element' FOCUSABLE ia2_hypertext='Button in menu element'
++ROLE_SYSTEM_MENUPOPUP xml-roles:menu ia2_hypertext='<obj0>'
++++ROLE_SYSTEM_MENUITEM name='Button in element with menu role' FOCUSABLE ia2_hypertext='Button in element with menu role'
<!--
@BLINK-ALLOW:inputType=*
@WIN-ALLOW:ia2_hypertext=*
@WIN-ALLOW:xml-roles:*
@AURALINUX-ALLOW:xml-roles:*
@AURALINUX-ALLOW:horizontal
@AURALINUX-ALLOW:vertical
@AURALINUX-ALLOW:focus
-->
<html>
<body>
<menu type="list">
<input type="button" value="Button in menu element">
</menu>
<div role="menu">
<input type="button" value="Button in element with menu role">
</div>
</body>
</html>
android.webkit.WebView focusable focused scrollable android.webkit.WebView focusable focused scrollable
++android.view.View ++android.view.View role_description='menu'
++++android.widget.CheckBox role_description='checkbox' checkable clickable focusable name='Checkbox1' ++++android.widget.CheckBox role_description='checkbox' checkable clickable focusable name='Checkbox1'
++++android.widget.CheckBox role_description='checkbox' checkable checked clickable focusable name='Checkbox2' ++++android.widget.CheckBox role_description='checkbox' checkable checked clickable focusable name='Checkbox2'
++android.view.View role_description='menu' ++android.view.View role_description='menu'
......
[document web] [document web]
++[section] ++[menu] xml-roles:menu
++++[check box] name='Checkbox1' checkable:true ++++[check box] name='Checkbox1' checkable:true
++++[check box] name='Checkbox2' checked checkable:true ++++[check box] name='Checkbox2' checked checkable:true
++[menu] xml-roles:menu ++[menu] xml-roles:menu
++++[check box] name='Checkbox3' checked checkable:true ++++[check box] name='Checkbox3' checked checkable:true
++++[check box] name='Checkbox4' indeterminate checkable:true ++++[check box] name='Checkbox4' indeterminate checkable:true
\ No newline at end of file
rootWebArea rootWebArea
++genericContainer ignored ++genericContainer ignored
++++genericContainer ignored ++++genericContainer ignored
++++++genericContainer ++++++menu
++++++++checkBox inputType='checkbox' name='Checkbox1' checkedState=false ++++++++checkBox inputType='checkbox' name='Checkbox1' checkedState=false
++++++++checkBox inputType='checkbox' name='Checkbox2' checkedState=true ++++++++checkBox inputType='checkbox' name='Checkbox2' checkedState=true
++++++menu ++++++menu
++++++++checkBox inputType='checkbox' name='Checkbox3' checkedState=true ++++++++checkBox inputType='checkbox' name='Checkbox3' checkedState=true
++++++++checkBox inputType='checkbox' name='Checkbox4' checkedState=mixed ++++++++checkBox inputType='checkbox' name='Checkbox4' checkedState=mixed
\ No newline at end of file
AXWebArea AXWebArea
++AXGroup ++AXMenu
++++AXCheckBox AXTitle='Checkbox1' AXValue=0 ++++AXCheckBox AXTitle='Checkbox1' AXValue=0
++++AXCheckBox AXTitle='Checkbox2' AXValue=1 ++++AXCheckBox AXTitle='Checkbox2' AXValue=1
++AXMenu ++AXMenu
++++AXCheckBox AXTitle='Checkbox3' AXValue=1 ++++AXCheckBox AXTitle='Checkbox3' AXValue=1
++++AXCheckBox AXTitle='Checkbox4' AXValue=2 ++++AXCheckBox AXTitle='Checkbox4' AXValue=2
\ No newline at end of file
Document Document
++Group IsControlElement=false ++Menu Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false
++++CheckBox Name='Checkbox1' Toggle.ToggleState='Off' ++++CheckBox Name='Checkbox1' Toggle.ToggleState='Off'
++++CheckBox Name='Checkbox2' Toggle.ToggleState='On' ++++CheckBox Name='Checkbox2' Toggle.ToggleState='On'
++Menu Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false ++Menu Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false
......
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>' ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0><obj1>' ++ROLE_SYSTEM_MENUPOPUP xml-roles:menu ia2_hypertext='<obj0><obj1>'
++++ROLE_SYSTEM_CHECKBUTTON name='Checkbox1' FOCUSABLE IA2_STATE_CHECKABLE checkable:true ++++ROLE_SYSTEM_CHECKBUTTON name='Checkbox1' FOCUSABLE IA2_STATE_CHECKABLE checkable:true
++++ROLE_SYSTEM_CHECKBUTTON name='Checkbox2' CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true ++++ROLE_SYSTEM_CHECKBUTTON name='Checkbox2' CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true
++ROLE_SYSTEM_MENUPOPUP xml-roles:menu ia2_hypertext='<obj0><obj1>' ++ROLE_SYSTEM_MENUPOPUP xml-roles:menu ia2_hypertext='<obj0><obj1>'
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
--> -->
<html> <html>
<body> <body>
<menu type="list"> <div role="menu">
<label><input type="checkbox" value="Checked1">Checkbox1</label> <label><input type="checkbox" value="Checked1">Checkbox1</label>
<label><input type="checkbox" checked value="Checked2">Checkbox2</label> <label><input type="checkbox" checked value="Checked2">Checkbox2</label>
</menu> </div>
<div role="menu"> <div role="menu">
<label><input type="checkbox" checked value="Checked3">Checkbox3</label> <label><input type="checkbox" checked value="Checked3">Checkbox3</label>
<label><input type="checkbox" id="checkbox4" value="Checked4">Checkbox4</label> <label><input type="checkbox" id="checkbox4" value="Checked4">Checkbox4</label>
......
android.webkit.WebView focusable focused scrollable
++android.view.View
++++android.widget.Button role_description='button' clickable focusable name='Bullet'
++android.view.View role_description='menu'
++++android.widget.Button role_description='button' clickable focusable name='Bullet'
\ No newline at end of file
[document web]
++[section]
++++[push button] name='Bullet'
++[menu]
++++[push button] name='Bullet'
rootWebArea
++genericContainer ignored
++++genericContainer ignored
++++++genericContainer
++++++++button inputType='image' name='Bullet'
++++++menu
++++++++button inputType='image' name='Bullet'
<!--
@BLINK-ALLOW:inputType=*
-->
<!DOCTYPE html>
<html>
<body>
<menu type="list">
<input type="image" src="bullet.png" alt="Bullet" value="Image button in menu element">
</menu>
<div role="menu">
<input type="image" src="bullet.png" alt="Bullet" value="Image button in element with menu role">
</div>
</body>
</html>
android.webkit.WebView focusable focused scrollable android.webkit.WebView focusable focused scrollable
++android.view.View ++android.view.View role_description='menu'
++++android.view.MenuItem role_description='radio button' checkable checked clickable focusable ++++android.widget.RadioButton role_description='radio button' checkable checked clickable focusable
++++android.widget.TextView name='Radio0 ' ++++android.widget.TextView name='Radio0 '
++++android.view.MenuItem role_description='radio button' checkable clickable focusable ++++android.widget.RadioButton role_description='radio button' checkable clickable focusable item_index=1 row_index=1
++++android.widget.TextView name='Radio1 ' ++++android.widget.TextView name='Radio1 '
++++android.widget.RadioButton role_description='radio button' checkable clickable focusable name='Radio2' item_index=2 row_index=2 ++++android.widget.RadioButton role_description='radio button' checkable clickable focusable name='Radio2' item_index=2 row_index=2
++android.view.View role_description='menu' ++android.view.View role_description='menu'
++++android.widget.RadioButton role_description='radio button' checkable clickable focusable name='Radio3' ++++android.widget.RadioButton role_description='radio button' checkable clickable focusable name='Radio3'
++++android.view.MenuItem role_description='radio button' checkable clickable focusable item_index=1 row_index=1 ++++android.widget.RadioButton role_description='radio button' checkable clickable focusable item_index=1 row_index=1
++++android.view.MenuItem role_description='radio button' checkable checked clickable focusable item_index=2 row_index=2 ++++android.widget.RadioButton role_description='radio button' checkable checked clickable focusable item_index=2 row_index=2
\ No newline at end of file \ No newline at end of file
[document web] [document web]
++[section] ++[menu] xml-roles:menu
++++[radio menu item] checked checkable:true ++++[radio button] checked checkable:true xml-roles:radio
++++[static] name='Radio0 ' ++++[static] name='Radio0 '
++++[radio menu item] checkable:true ++++[radio button] checkable:true xml-roles:radio
++++[static] name='Radio1 ' ++++[static] name='Radio1 '
++++[radio button] name='Radio2' checkable:true xml-roles:radio ++++[radio button] name='Radio2' checkable:true xml-roles:radio
++[menu] xml-roles:menu ++[menu] xml-roles:menu
++++[radio button] name='Radio3' checkable:true xml-roles:radio ++++[radio button] name='Radio3' checkable:true xml-roles:radio
++++[radio menu item] checkable:true ++++[radio button] checkable:true xml-roles:radio
++++[radio menu item] checked checkable:true ++++[radio button] checked checkable:true xml-roles:radio
\ No newline at end of file
rootWebArea rootWebArea
++genericContainer ignored ++genericContainer ignored
++++genericContainer ignored ++++genericContainer ignored
++++++genericContainer ++++++menu
++++++++menuItemRadio inputType='radio' checkedState=true ++++++++radioButton inputType='radio' checkedState=true
++++++++staticText name='Radio0 ' ++++++++staticText name='Radio0 '
++++++++++inlineTextBox name='Radio0 ' ++++++++++inlineTextBox name='Radio0 '
++++++++menuItemRadio inputType='radio' checkedState=false ++++++++radioButton inputType='radio' checkedState=false
++++++++staticText name='Radio1 ' ++++++++staticText name='Radio1 '
++++++++++inlineTextBox name='Radio1 ' ++++++++++inlineTextBox name='Radio1 '
++++++++radioButton inputType='radio' name='Radio2' checkedState=false ++++++++radioButton inputType='radio' name='Radio2' checkedState=false
++++++menu ++++++menu
++++++++radioButton inputType='radio' name='Radio3' checkedState=false ++++++++radioButton inputType='radio' name='Radio3' checkedState=false
++++++++menuItemRadio inputType='radio' checkedState=false ++++++++radioButton inputType='radio' checkedState=false
++++++++menuItemRadio inputType='radio' checkedState=true ++++++++radioButton inputType='radio' checkedState=true
\ No newline at end of file
Document Document
++Group IsControlElement=false ++Menu Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false
++++RadioButton SelectionItem.IsSelected=true ++++RadioButton SelectionItem.IsSelected=true
++++Text Name='Radio0 ' ++++Text Name='Radio0 '
++++RadioButton SelectionItem.IsSelected=false ++++RadioButton SelectionItem.IsSelected=false
......
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>' ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>'
++IA2_ROLE_SECTION ia2_hypertext='<obj0>Radio0 <obj2>Radio1 <obj4>' ++ROLE_SYSTEM_MENUPOPUP ia2_hypertext='<obj0>Radio0 <obj2>Radio1 <obj4>'
++++IA2_ROLE_RADIO_MENU_ITEM CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true ++++ROLE_SYSTEM_RADIOBUTTON CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true
++++ROLE_SYSTEM_STATICTEXT name='Radio0 ' ia2_hypertext='Radio0 ' ++++ROLE_SYSTEM_STATICTEXT name='Radio0 ' ia2_hypertext='Radio0 '
++++IA2_ROLE_RADIO_MENU_ITEM FOCUSABLE IA2_STATE_CHECKABLE checkable:true ++++ROLE_SYSTEM_RADIOBUTTON FOCUSABLE IA2_STATE_CHECKABLE checkable:true
++++ROLE_SYSTEM_STATICTEXT name='Radio1 ' ia2_hypertext='Radio1 ' ++++ROLE_SYSTEM_STATICTEXT name='Radio1 ' ia2_hypertext='Radio1 '
++++ROLE_SYSTEM_RADIOBUTTON name='Radio2' FOCUSABLE IA2_STATE_CHECKABLE checkable:true ++++ROLE_SYSTEM_RADIOBUTTON name='Radio2' FOCUSABLE IA2_STATE_CHECKABLE checkable:true
++ROLE_SYSTEM_MENUPOPUP ia2_hypertext='<obj0><obj1><obj2>' ++ROLE_SYSTEM_MENUPOPUP ia2_hypertext='<obj0><obj1><obj2>'
++++ROLE_SYSTEM_RADIOBUTTON name='Radio3' FOCUSABLE IA2_STATE_CHECKABLE checkable:true ++++ROLE_SYSTEM_RADIOBUTTON name='Radio3' FOCUSABLE IA2_STATE_CHECKABLE checkable:true
++++IA2_ROLE_RADIO_MENU_ITEM FOCUSABLE IA2_STATE_CHECKABLE checkable:true ++++ROLE_SYSTEM_RADIOBUTTON FOCUSABLE IA2_STATE_CHECKABLE checkable:true
++++IA2_ROLE_RADIO_MENU_ITEM CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true ++++ROLE_SYSTEM_RADIOBUTTON CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true
\ No newline at end of file
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
--> -->
<html> <html>
<body> <body>
<menu type="list"> <div role="menu">
<input type="radio" name="rg1" value="r0" checked>Radio0 <input type="radio" name="rg1" value="r0" checked>Radio0
<input type="radio" name="rg1" value="r1">Radio1 <input type="radio" name="rg1" value="r1">Radio1
<label><input type="radio" name="rg1" value="r2">Radio2</label> <label><input type="radio" name="rg1" value="r2">Radio2</label>
</menu> </div>
<div role="menu"> <div role="menu">
<label><input type="radio" name="rg2" value="r3">Radio3</label> <label><input type="radio" name="rg2" value="r3">Radio3</label>
<input type="radio" name="rg2" value="r4"> <input type="radio" name="rg2" value="r4">
......
android.webkit.WebView focusable focused scrollable
++android.view.View name='Menu is deprecated, but it may still be used semantically with list item children. For more history, see crbug.com/87553.'
++android.widget.ListView collection item_count=2 row_count=2
++++android.view.View collection_item name='Cats'
++++android.view.View collection_item name='Dogs' item_index=1 row_index=1
\ No newline at end of file
[document web]
++[paragraph]
++++[static] name='Menu is deprecated, but it may still be used semantically with list item children. For more history, see crbug.com/87553.'
++[list]
++++[list item]
++++++[static] name='Cats'
++++[list item]
++++++[static] name='Dogs'
rootWebArea
++genericContainer ignored
++++genericContainer ignored
++++++paragraph
++++++++staticText name='Menu is deprecated, but it may still be used semantically with list item children. For more history, see crbug.com/87553.'
++++++++++inlineTextBox name='Menu is deprecated, but it may still be used semantically with list item children. For more history, see crbug.com/87553.'
++++++list
++++++++listItem
++++++++++staticText name='Cats'
++++++++++++inlineTextBox name='Cats'
++++++++listItem
++++++++++staticText name='Dogs'
++++++++++++inlineTextBox name='Dogs'
AXWebArea
++AXGroup
++++AXStaticText AXValue='Menu is deprecated, but it may still be used semantically with list item children. For more history, see crbug.com/87553.'
++AXList
++++AXGroup
++++++AXStaticText AXValue='Cats'
++++AXGroup
++++++AXStaticText AXValue='Dogs'
Document
++Group IsControlElement=false
++++Text Name='Menu is deprecated, but it may still be used semantically with list item children. For more history, see crbug.com/87553.'
++List
++++ListItem
++++++Text Name='Cats' IsControlElement=false
++++ListItem
++++++Text Name='Dogs' IsControlElement=false
\ No newline at end of file
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++IA2_ROLE_PARAGRAPH
++++ROLE_SYSTEM_STATICTEXT name='Menu is deprecated, but it may still be used semantically with list item children. For more history, see crbug.com/87553.'
++ROLE_SYSTEM_LIST READONLY
++++ROLE_SYSTEM_LISTITEM READONLY
++++++ROLE_SYSTEM_STATICTEXT name='Cats'
++++ROLE_SYSTEM_LISTITEM READONLY
++++++ROLE_SYSTEM_STATICTEXT name='Dogs'
\ No newline at end of file
rootWebArea
++genericContainer ignored
++++genericContainer ignored
++++++genericContainer ignored
++++++++paragraph
++++++++++staticText name='Right-click inside this box to see the context menu!'
++++++++++++inlineTextBox name='Right-click inside this box to see the context menu!'
++++++++genericContainer ignored
++++++++++genericContainer
++++++++++genericContainer
<!DOCTYPE html>
<html>
<body>
<div style="border:1px solid #cccccc;" contextmenu="Chromemenu">
<p>Right-click inside this box to see the context menu!
<menu type="context" id="Chromemenu">
<menuitem label="Refresh" onclick="window.location.reload();"></menuitem>
<menuitem label="Email This Page" onclick="window.location='mailto:?body='+window.location.href;"></menuitem>
</menu>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<style>li { list-style-type: none; }</style>
<p>
Menu is deprecated, but it may still be used semantically with list item children.
For more history, see crbug.com/87553.
</p>
<menu>
<li>Cats</li>
<li>Dogs</li>
</menu>
</body>
</html>
...@@ -372,6 +372,7 @@ AXObjectInclusion AXNodeObject::ShouldIncludeBasedOnSemantics( ...@@ -372,6 +372,7 @@ AXObjectInclusion AXNodeObject::ShouldIncludeBasedOnSemantics(
ax::mojom::blink::Role::kDialog, ax::mojom::blink::Role::kDialog,
ax::mojom::blink::Role::kFigcaption, ax::mojom::blink::Role::kFigcaption,
ax::mojom::blink::Role::kFigure, ax::mojom::blink::Role::kFigure,
ax::mojom::blink::Role::kList,
ax::mojom::blink::Role::kListItem, ax::mojom::blink::Role::kListItem,
ax::mojom::blink::Role::kMark, ax::mojom::blink::Role::kMark,
ax::mojom::blink::Role::kMath, ax::mojom::blink::Role::kMath,
...@@ -788,22 +789,10 @@ ax::mojom::blink::Role AXNodeObject::NativeRoleIgnoringAria() const { ...@@ -788,22 +789,10 @@ ax::mojom::blink::Role AXNodeObject::NativeRoleIgnoringAria() const {
const AtomicString& type = input->type(); const AtomicString& type = input->type();
if (input->DataList() && type != input_type_names::kColor) if (input->DataList() && type != input_type_names::kColor)
return ax::mojom::blink::Role::kTextFieldWithComboBox; return ax::mojom::blink::Role::kTextFieldWithComboBox;
if (type == input_type_names::kButton) { if (type == input_type_names::kButton)
if ((GetNode()->parentNode() &&
IsA<HTMLMenuElement>(GetNode()->parentNode())) ||
(ParentObject() &&
ParentObject()->RoleValue() == ax::mojom::blink::Role::kMenu))
return ax::mojom::blink::Role::kMenuItem;
return ButtonRoleType(); return ButtonRoleType();
} if (type == input_type_names::kCheckbox)
if (type == input_type_names::kCheckbox) {
if ((GetNode()->parentNode() &&
IsA<HTMLMenuElement>(GetNode()->parentNode())) ||
(ParentObject() &&
ParentObject()->RoleValue() == ax::mojom::blink::Role::kMenu))
return ax::mojom::blink::Role::kMenuItemCheckBox;
return ax::mojom::blink::Role::kCheckBox; return ax::mojom::blink::Role::kCheckBox;
}
if (type == input_type_names::kDate) if (type == input_type_names::kDate)
return ax::mojom::blink::Role::kDate; return ax::mojom::blink::Role::kDate;
if (type == input_type_names::kDatetime || if (type == input_type_names::kDatetime ||
...@@ -812,14 +801,8 @@ ax::mojom::blink::Role AXNodeObject::NativeRoleIgnoringAria() const { ...@@ -812,14 +801,8 @@ ax::mojom::blink::Role AXNodeObject::NativeRoleIgnoringAria() const {
return ax::mojom::blink::Role::kDateTime; return ax::mojom::blink::Role::kDateTime;
if (type == input_type_names::kFile) if (type == input_type_names::kFile)
return ax::mojom::blink::Role::kButton; return ax::mojom::blink::Role::kButton;
if (type == input_type_names::kRadio) { if (type == input_type_names::kRadio)
if ((GetNode()->parentNode() &&
IsA<HTMLMenuElement>(GetNode()->parentNode())) ||
(ParentObject() &&
ParentObject()->RoleValue() == ax::mojom::blink::Role::kMenu))
return ax::mojom::blink::Role::kMenuItemRadio;
return ax::mojom::blink::Role::kRadioButton; return ax::mojom::blink::Role::kRadioButton;
}
if (type == input_type_names::kNumber) if (type == input_type_names::kNumber)
return ax::mojom::blink::Role::kSpinButton; return ax::mojom::blink::Role::kSpinButton;
if (input->IsTextButton()) if (input->IsTextButton())
...@@ -863,6 +846,15 @@ ax::mojom::blink::Role AXNodeObject::NativeRoleIgnoringAria() const { ...@@ -863,6 +846,15 @@ ax::mojom::blink::Role AXNodeObject::NativeRoleIgnoringAria() const {
if (IsA<HTMLDivElement>(*GetNode())) if (IsA<HTMLDivElement>(*GetNode()))
return RoleFromLayoutObject(ax::mojom::blink::Role::kGenericContainer); return RoleFromLayoutObject(ax::mojom::blink::Role::kGenericContainer);
if (IsA<HTMLMenuElement>(*GetNode())) {
// <menu> is a deprecated feature of HTML 5, but is included for semantic
// compatibility with HTML3, and may contain list items. Exposing it as an
// unordered list works better than the current HTML-AAM recommendaton of
// exposing as a role=menu, because if it's just used semantically, it won't
// be interactive. If used as a widget, the author must provide role=menu.
return ax::mojom::blink::Role::kList;
}
if (IsA<HTMLMeterElement>(*GetNode())) if (IsA<HTMLMeterElement>(*GetNode()))
return ax::mojom::blink::Role::kMeter; return ax::mojom::blink::Role::kMeter;
......
...@@ -46,9 +46,9 @@ PASS elem.role is "AXRole: AXRadioButton" ...@@ -46,9 +46,9 @@ PASS elem.role is "AXRole: AXRadioButton"
menu_button_id menu_button_id
PASS elem.role is "AXRole: AXButton" PASS elem.role is "AXRole: AXButton"
menu_checkbox_id menu_checkbox_id
PASS elem.role is "AXRole: AXMenuItemCheckBox" PASS elem.role is "AXRole: AXCheckBox"
menu_radio_id menu_radio_id
PASS elem.role is "AXRole: AXMenuItemRadio" PASS elem.role is "AXRole: AXRadioButton"
input_date_id input_date_id
PASS elem.role is "AXRole: AXDate" PASS elem.role is "AXRole: AXDate"
input_datetime_id input_datetime_id
......
...@@ -109,8 +109,8 @@ if (window.testRunner && window.accessibilityController) { ...@@ -109,8 +109,8 @@ if (window.testRunner && window.accessibilityController) {
hasRole("input_radio_id", "AXRole: AXRadioButton"); hasRole("input_radio_id", "AXRole: AXRadioButton");
hasRole("menu_button_id", "AXRole: AXButton"); hasRole("menu_button_id", "AXRole: AXButton");
hasRole("menu_checkbox_id", "AXRole: AXMenuItemCheckBox"); hasRole("menu_checkbox_id", "AXRole: AXCheckBox");
hasRole("menu_radio_id", "AXRole: AXMenuItemRadio"); hasRole("menu_radio_id", "AXRole: AXRadioButton");
hasRole("input_date_id", "AXRole: AXDate"); hasRole("input_date_id", "AXRole: AXDate");
hasRole("input_datetime_id", "AXRole: AXTextField"); hasRole("input_datetime_id", "AXRole: AXTextField");
......
...@@ -96,14 +96,16 @@ AXRole: AXGenericContainer ...@@ -96,14 +96,16 @@ AXRole: AXGenericContainer
AXRole: AXStaticText "Button has a button role because it has an explicit role." AXRole: AXStaticText "Button has a button role because it has an explicit role."
AXRole: AXInlineTextBox "Button has a button role because it has an explicit role." AXRole: AXInlineTextBox "Button has a button role because it has an explicit role."
AXRole: AXPresentational AXRole: AXPresentational
AXRole: AXMenuItemCheckBox AXRole: AXCheckBox
AXRole: AXStaticText " I have a bike " AXRole: AXStaticText " I have a bike "
AXRole: AXInlineTextBox " I have a bike " AXRole: AXInlineTextBox " I have a bike "
AXRole: AXButton "Click me" AXRole: AXButton "Click me"
AXRole: AXMenuItemRadio AXRole: AXStaticText "Click me"
AXRole: AXInlineTextBox "Click me"
AXRole: AXRadioButton
AXRole: AXStaticText " Male " AXRole: AXStaticText " Male "
AXRole: AXInlineTextBox " Male " AXRole: AXInlineTextBox " Male "
AXRole: AXMenuItemRadio AXRole: AXRadioButton
AXRole: AXStaticText " Female" AXRole: AXStaticText " Female"
AXRole: AXInlineTextBox " Female" AXRole: AXInlineTextBox " Female"
AXRole: AXGenericContainer AXRole: AXGenericContainer
......
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