Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1238)

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp

Issue 2893683002: Selection follows focus/activedescendant in single selection containers (Closed)
Patch Set: Last test to fix we hope Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
index eb389e086c2e0d601ae68e914321c49eadd939c2..519d956fc3097f51139a4c759be5800aa06bb291 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
@@ -540,6 +540,13 @@ AccessibilityRole AXNodeObject::NativeAccessibilityRoleIgnoringAria() const {
return select_element.IsMultiple() ? kListBoxRole : kPopUpButtonRole;
}
+ if (isHTMLOptionElement(*GetNode())) {
+ HTMLSelectElement* select_element =
+ toHTMLOptionElement(GetNode())->OwnerSelectElement();
+ return select_element->IsMultiple() ? kListBoxOptionRole
+ : kMenuListOptionRole;
+ }
+
if (isHTMLTextAreaElement(*GetNode()))
return kTextFieldRole;
@@ -1289,6 +1296,15 @@ bool AXNodeObject::CanSetFocusAttribute() const {
if (IsDisabledFormControl(node))
return false;
+ // Check for options here because AXListBoxOption and AXMenuListOption
+ // don't help when the <option> is canvas fallback, and because
+ // a common case for aria-owns from a textbox that points to a list
+ // does not change the hierarchy (textboxes don't suport children)
+ if ((RoleValue() == kListBoxOptionRole ||
+ RoleValue() == kMenuListOptionRole) &&
+ IsEnabled())
+ return true;
+
return node->IsElementNode() && ToElement(node)->SupportsFocus();
}
@@ -1308,11 +1324,13 @@ bool AXNodeObject::CanSetValueAttribute() const {
}
bool AXNodeObject::CanSetSelectedAttribute() const {
- // ARIA list box options can be selected if they are children of an element
- // with an aria-activedescendant attribute.
- if (AriaRoleAttribute() == kListBoxOptionRole &&
- AncestorExposesActiveDescendant())
+ const AccessibilityRole role = AriaRoleAttribute();
+ // These elements can be selected if not disabled (native or ARIA)
+ if ((role == kListBoxOptionRole || role == kMenuListOptionRole ||
+ role == kTreeItemRole || role == kCellRole || role == kTabRole) &&
David Tseng 2017/06/06 21:28:47 The spec includes the roles: gridcell option row
+ IsEnabled() && CanSetFocusAttribute()) {
return true;
+ }
return AXObjectImpl::CanSetSelectedAttribute();
}
@@ -2239,15 +2257,18 @@ bool AXNodeObject::CanHaveChildren() const {
switch (role) {
case kImageRole:
case kButtonRole:
- case kPopUpButtonRole:
case kCheckBoxRole:
case kRadioButtonRole:
case kSwitchRole:
case kTabRole:
case kToggleButtonRole:
case kListBoxOptionRole:
+ case kMenuButtonRole:
+ case kMenuListOptionRole:
case kScrollBarRole:
return false;
+ case kPopUpButtonRole:
+ return isHTMLSelectElement(GetNode());
case kStaticTextRole:
if (!AxObjectCache().InlineTextBoxAccessibilityEnabled())
return false;

Powered by Google App Engine
This is Rietveld 408576698