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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.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/AXLayoutObject.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
index 803370747873c15192e64a72b909aa4aea3faaa8..1d61300aa072ec93cf624494b1b718e3ab5f8b46 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
@@ -457,22 +457,28 @@ bool AXLayoutObject::IsFocused() const {
}
bool AXLayoutObject::IsSelected() const {
- if (!GetLayoutObject() || !GetNode())
+ if (!GetLayoutObject() || !GetNode() || !CanSetSelectedAttribute())
return false;
- if (AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kSelected))
- return true;
-
- AXObjectImpl* focused_object = AxObjectCache().FocusedObject();
- if (AriaRoleAttribute() == kListBoxOptionRole && focused_object &&
- focused_object->ActiveDescendant() == this) {
- return true;
- }
+ // aria-selected overrides automatic behaviors
David Tseng 2017/06/06 20:58:30 Note that this doesn't actually happen because the
+ bool is_selected;
+ if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kSelected, is_selected))
+ return is_selected;
+ // Tab item with focus in the associated tab
if (IsTabItem() && IsTabItemSelected())
return true;
- return false;
+ // Selection follows focus, but ONLY in single selection containers,
+ // and only if aria-selected was not present to override
+
+ AXObjectImpl* container = ContainerWidget();
+ if (!container || container->IsMultiSelectable())
+ return false;
+
+ AXObjectImpl* focused_object = AxObjectCache().FocusedObject();
+ return focused_object == this ||
+ (focused_object && focused_object->ActiveDescendant() == this);
}
//

Powered by Google App Engine
This is Rietveld 408576698