Commit e2ef7518 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Follow CORE-AAM rules for exposing illegal ARIA values

ARIA booleans that are not "false" and not explicitly undefined should be exposed as true.
ARIA object attributes that expose token should expose the error values and let the AT decide what to do with them. (This enables experimentation with new ARIA experiences, without changing the shipping browser code).

Bug: 746621
Change-Id: I91381f17db5ad179f26b02b81434b36f78492f0d
Reviewed-on: https://chromium-review.googlesource.com/584018
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491273}
parent 3c1842b7
......@@ -498,6 +498,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaGroup) {
RunAriaTest(FILE_PATH_LITERAL("aria-group.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaIllegalVal) {
RunAriaTest(FILE_PATH_LITERAL("aria-illegal-val.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaImg) {
RunAriaTest(FILE_PATH_LITERAL("aria-img.html"));
}
......
rootWebArea
++log containerLiveRelevant='additions text' containerLiveStatus='polite' name='Atomic illegal' liveRelevant='additions text' liveStatus='polite' containerLiveAtomic=true containerLiveBusy=false liveAtomic=true
++textField autoComplete='x-illegal' name='Autocomplete illegal'
++log containerLiveRelevant='additions text' containerLiveStatus='polite' name='Busy illegal' liveRelevant='additions text' liveStatus='polite' busy=true containerLiveAtomic=false containerLiveBusy=true liveAtomic=false
++treeItem selectable name='Checked illegal' checkedState=true
++genericContainer name='Current illegal' ariaCurrentState=true
++genericContainer name='Disabled illegal' restriction=disabled
++genericContainer name='Dropeffect illegal'
++treeItem expanded selectable name='Expanded illegal'
++genericContainer name='Grabbed illegal'
++popUpButton haspopup name='Haspopup illegal'
++genericContainer ariaInvalidValue='X-ILLEGAL' name='Invalid illegal' invalidState=other
++log containerLiveRelevant='additions text' containerLiveStatus='X-ILLEGAL' name='Live illegal' liveRelevant='additions text' liveStatus='X-ILLEGAL' containerLiveAtomic=false containerLiveBusy=false liveAtomic=false
++dialog name='Modal illegal' modal=true
++textField multiline name='Multiline illegal'
++grid multiselectable name='Multiselectable illegal'
++++tableHeaderContainer
++slider horizontal name='Orientation illegal'
++toggleButton name='Pressed illegal' checkedState=true
++textField name='Readonly illegal' restriction=readOnly
++log containerLiveRelevant='X-ILLEGAL' containerLiveStatus='polite' name='Relevant illegal' liveRelevant='X-ILLEGAL' liveStatus='polite' containerLiveAtomic=false containerLiveBusy=false liveAtomic=false
++textField required name='Required illegal'
++tree multiselectable vertical
++++treeItem selectable selected name='Selected illegal'
++columnHeader selectable name='Sort illegal' sortDirection=other
\ No newline at end of file
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++ROLE_SYSTEM_CLIENT name='Atomic illegal' live:polite relevant:additions text atomic:true
++ROLE_SYSTEM_TEXT name='Autocomplete illegal' autocomplete:x-illegal
++ROLE_SYSTEM_CLIENT name='Busy illegal' BUSY live:polite relevant:additions text atomic:false
++ROLE_SYSTEM_OUTLINEITEM name='Checked illegal' CHECKED IA2_STATE_CHECKABLE checkable:true
++IA2_ROLE_SECTION name='Current illegal' current:true
++IA2_ROLE_SECTION name='Disabled illegal' UNAVAILABLE
++IA2_ROLE_SECTION name='Dropeffect illegal' dropeffect:X-ILLEGAL
++ROLE_SYSTEM_OUTLINEITEM name='Expanded illegal' EXPANDED
++IA2_ROLE_SECTION name='Grabbed illegal' grabbed:X-ILLEGAL
++ROLE_SYSTEM_BUTTONMENU name='Haspopup illegal' HASPOPUP
++IA2_ROLE_SECTION name='Invalid illegal' IA2_STATE_INVALID_ENTRY
++ROLE_SYSTEM_CLIENT name='Live illegal' live:X-ILLEGAL relevant:additions text atomic:false
++ROLE_SYSTEM_DIALOG name='Modal illegal' IA2_STATE_MODAL
++ROLE_SYSTEM_TEXT name='Multiline illegal' IA2_STATE_MULTI_LINE
++ROLE_SYSTEM_TABLE name='Multiselectable illegal' MULTISELECTABLE
++++IA2_ROLE_SECTION
++ROLE_SYSTEM_SLIDER name='Orientation illegal' IA2_STATE_HORIZONTAL
++IA2_ROLE_TOGGLE_BUTTON name='Pressed illegal' PRESSED IA2_STATE_CHECKABLE checkable:true
++ROLE_SYSTEM_TEXT name='Readonly illegal' READONLY
++ROLE_SYSTEM_CLIENT name='Relevant illegal' live:polite relevant:X-ILLEGAL atomic:false
++ROLE_SYSTEM_TEXT name='Required illegal' IA2_STATE_REQUIRED
++ROLE_SYSTEM_OUTLINE MULTISELECTABLE
++++ROLE_SYSTEM_OUTLINEITEM name='Selected illegal' SELECTED
++ROLE_SYSTEM_COLUMNHEADER name='Sort illegal' sort:other
\ No newline at end of file
<!DOCTYPE html>
<!--
Test ARIA boolean/token properties using illegal values.
Boolean properties should be exposed as true.
@WIN-ALLOW:atomic*
@WIN-ALLOW:autocomplete*
@WIN-ALLOW:current*
@WIN-ALLOW:drop*
@WIN-ALLOW:grab*
@WIN-ALLOW:live*
@WIN-ALLOW:relevant*
@WIN-ALLOW:sort*
@WIN-ALLOW:IA2_STATE_HORIZ*
@WIN-DENY:currentVal*
@BLINK-DENY:hierarchical*
@BLINK-DENY:*ForRange*
@BLINK-ALLOW:ariaCurrent*
@BLINK-ALLOW:autoComplete*
@BLINK-ALLOW:busy*
@BLINK-ALLOW:checked*
@BLINK-ALLOW:collapsed*
@BLINK-ALLOW:container*
@BLINK-ALLOW:disabled*
@BLINK-ALLOW:drop*
@BLINK-ALLOW:expanded*
@BLINK-ALLOW:haspopup*
@BLINK-ALLOW:horizontal*
@BLINK-ALLOW:invalid*
@BLINK-ALLOW:live*
@BLINK-ALLOW:modal*
@BLINK-ALLOW:multiline*
@BLINK-ALLOW:multiselect*
@BLINK-ALLOW:pressed*
@BLINK-ALLOW:required*
@BLINK-ALLOW:restriction*
@BLINK-ALLOW:select*
@BLINK-ALLOW:sort*
@BLINK-ALLOW:vertical*
-->
<html>
<body>
<!-- Technically, illegal atomic values should be exposed in the object attr,
does not seem like a priority -->
<div aria-atomic="X-ILLEGAL" role="log" aria-label="Atomic illegal"></div>
<div aria-autocomplete="X-ILLEGAL" role="textbox" aria-label="Autocomplete illegal"></div>
<div aria-busy="X-ILLEGAL" role="log" aria-label="Busy illegal"></div>
<div aria-checked="X-ILLEGAL" role="treeitem" aria-label="Checked illegal"></div>
<!-- aria-current rules from https://www.w3.org/TR/wai-aria-1.1/#aria-current:
"Any value not included in the list of allowed values should be treated by
assistive technologies as if the value true had been provided." -->
<div aria-current="X-ILLEGAL" aria-label="Current illegal"></div>
<div aria-disabled="X-ILLEGAL" aria-label="Disabled illegal"></div>
<div aria-dropeffect="X-ILLEGAL" aria-label="Dropeffect illegal"></div>
<div aria-expanded="X-ILLEGAL" role="treeitem" aria-label="Expanded illegal"></div>
<div aria-grabbed="X-ILLEGAL" aria-label="Grabbed illegal"></div>
<div aria-haspopup="X-ILLEGAL" role="button" aria-label="Haspopup illegal"></div>
<div aria-invalid="X-ILLEGAL" aria-label="Invalid illegal"></div>
<div aria-live="X-ILLEGAL" role="log" aria-label="Live illegal"></div>
<div aria-modal="X-ILLEGAL" role="dialog" aria-label="Modal illegal"></div>
<div aria-multiline="X-ILLEGAL" role="textbox" aria-label="Multiline illegal"></div>
<div aria-multiselectable="X-ILLEGAL" role="grid" aria-label="Multiselectable illegal"></div>
<!-- For aria-orientation, use default for the given role -->
<div aria-orientation="X-ILLEGAL" role="slider" aria-label="Orientation illegal"></div>
<div aria-pressed="X-ILLEGAL" role="button" aria-label="Pressed illegal"></div>
<div aria-readonly="X-ILLEGAL" role="textbox" aria-label="Readonly illegal"></div>
<div aria-relevant="X-ILLEGAL" role="log" aria-label="Relevant illegal"></div>
<div aria-required="X-ILLEGAL" role="textbox" aria-label="Required illegal"></div>
<!-- Test selected inside multiselectable. -->
<div role="tree" aria-multiselectable="true">
<div aria-selected="X-ILLEGAL" role="treeitem" aria-label="Selected illegal"></div>
</div>
<!-- Technically, aria-sort illegal value should be exposed in object attribute -->
<div aria-sort="X-ILLEGAL" role="columnheader" aria-label="Sort illegal"></div>
<!-- Test aria-hidden at end because a broken test can have extra object,
and ruin the rest of the test. -->
<div aria-hidden="X-ILLEGAL" aria-label="Hidden illegal"></div>
</body>
</html>
\ No newline at end of file
android.webkit.WebView focusable focused scrollable
++android.widget.CheckBox role_description='switch' checkable clickable name='Switch1'
++android.widget.CheckBox role_description='switch' checkable checked clickable name='Switch2'
++android.widget.CheckBox role_description='switch' checkable clickable name='Switch3'
++android.widget.CheckBox role_description='switch' checkable checked clickable name='Switch3'
rootWebArea
++switch name='Switch1' checkedState=false
++switch name='Switch2' checkedState=true
++switch name='Switch3' checkedState=false
\ No newline at end of file
++switch name='Switch3' checkedState=true
\ No newline at end of file
AXWebArea AXRoleDescription='HTML content'
++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXTitle='Switch1' AXValue='0'
++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXTitle='Switch2' AXValue='1'
++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXTitle='Switch3' AXValue='0'
++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXTitle='Switch3' AXValue='1'
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1><obj2>'
++IA2_ROLE_TOGGLE_BUTTON name='Switch1' IA2_STATE_CHECKABLE xml-roles:switch checkable:true ia2_hypertext='Switch1'
++IA2_ROLE_TOGGLE_BUTTON name='Switch2' CHECKED IA2_STATE_CHECKABLE xml-roles:switch checkable:true ia2_hypertext='Switch2'
++IA2_ROLE_TOGGLE_BUTTON name='Switch3' IA2_STATE_CHECKABLE xml-roles:switch checkable:true ia2_hypertext='Switch3'
\ No newline at end of file
++IA2_ROLE_TOGGLE_BUTTON name='Switch3' CHECKED IA2_STATE_CHECKABLE xml-roles:switch checkable:true ia2_hypertext='Switch3'
\ No newline at end of file
......@@ -447,7 +447,7 @@ bool AccessibleNode::GetPropertyOrARIAAttribute(Element* element,
QualifiedName attribute = GetCorrespondingARIAAttribute(property);
AtomicString attr_value = element->FastGetAttribute(attribute);
is_null = IsUndefinedAttrValue(attr_value);
return EqualIgnoringASCIICase(attr_value, "true");
return !is_null && !EqualIgnoringASCIICase(attr_value, "false");
}
// static
......
......@@ -1502,18 +1502,15 @@ unsigned AXNodeObject::HierarchicalLevel() const {
}
String AXNodeObject::AriaAutoComplete() const {
if (RoleValue() != kComboBoxRole)
if (!IsARIATextControl())
return String();
const AtomicString& aria_auto_complete =
GetAOMPropertyOrARIAAttribute(AOMStringProperty::kAutocomplete)
.DeprecatedLower();
if (aria_auto_complete == "inline" || aria_auto_complete == "list" ||
aria_auto_complete == "both")
return aria_auto_complete;
return String();
// Illegal values must be passed through, according to CORE-AAM.
return aria_auto_complete == "none" ? String() : aria_auto_complete;
}
namespace {
......
......@@ -528,17 +528,16 @@ AccessibilityCheckedState AXObject::CheckedState() const {
: AOMStringProperty::kChecked;
const AtomicString& checked_attribute = GetAOMPropertyOrARIAAttribute(prop);
if (checked_attribute) {
if (EqualIgnoringASCIICase(checked_attribute, "true"))
return kCheckedStateTrue;
if (EqualIgnoringASCIICase(checked_attribute, "mixed")) {
// Only checkable role that doesn't support mixed is the switch.
if (role != kSwitchRole)
return kCheckedStateMixed;
}
if (EqualIgnoringASCIICase(checked_attribute, "false"))
return kCheckedStateFalse;
// Anything other than "false" should be treated as "true".
return EqualIgnoringASCIICase(checked_attribute, "false")
? kCheckedStateFalse
: kCheckedStateTrue;
}
// Native checked state
......@@ -1387,8 +1386,7 @@ int AXObject::IndexInParent() const {
bool AXObject::IsLiveRegion() const {
const AtomicString& live_region = LiveRegionStatus();
return EqualIgnoringASCIICase(live_region, "polite") ||
EqualIgnoringASCIICase(live_region, "assertive");
return !live_region.IsEmpty() && !EqualIgnoringASCIICase(live_region, "off");
}
AXObject* AXObject::LiveRegionRoot() const {
......
......@@ -237,9 +237,9 @@ SortDirection AXTableCell::GetSortDirection() const {
return kSortDirectionAscending;
if (EqualIgnoringASCIICase(aria_sort, "descending"))
return kSortDirectionDescending;
if (EqualIgnoringASCIICase(aria_sort, "other"))
return kSortDirectionOther;
return kSortDirectionUndefined;
// Technically, illegal values should be exposed as is, but this does
// not seem to be worth the implementation effort at this time.
return kSortDirectionOther;
}
} // namespace blink
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