Commit 7cd0f2cd authored by Jessica Tallon's avatar Jessica Tallon Committed by Commit Bot

Ensure blink accessibility state remains in sync for listbox options

There were some situations where list box options were not being
deselected when the selection moved to a different option. This had
the affect of screen readers getting the information which wasn't
correct. This fixes that by marking the listbox as dirty to ensure the
list box options remain in sync when the selection changes.

Bug: 980368
Change-Id: Icff41b23218ce2db7ac5437be642371894a92b07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821902Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Jessica Tallon <jtallon@igalia.com>
Cr-Commit-Position: refs/heads/master@{#703423}
parent f861610d
......@@ -255,6 +255,11 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
RunEventTest(FILE_PATH_LITERAL("aria-combo-box-expand.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsAriaComboBoxSelect) {
RunEventTest(FILE_PATH_LITERAL("aria-combo-box-select.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsAriaControlsChanged) {
RunEventTest(FILE_PATH_LITERAL("aria-controls-changed.html"));
......
......@@ -2,5 +2,5 @@ EVENT_OBJECT_FOCUS on <li#option1> role=ROLE_SYSTEM_LISTITEM name="Apple" SELECT
EVENT_OBJECT_SELECTION on <li#option1> role=ROLE_SYSTEM_LISTITEM name="Apple" SELECTED,FOCUSED,FOCUSABLE,SELECTABLE PosInSet=1 SetSize=3
EVENT_OBJECT_SELECTIONWITHIN on <ul#list> role=ROLE_SYSTEM_LIST IA2_STATE_VERTICAL SetSize=3
EVENT_OBJECT_STATECHANGE on <input> role=ROLE_SYSTEM_COMBOBOX EXPANDED,FOCUSABLE,HASPOPUP IA2_STATE_EDITABLE,IA2_STATE_SELECTABLE_TEXT,IA2_STATE_SINGLE_LINE,IA2_STATE_SUPPORTS_AUTOCOMPLETION
EVENT_OBJECT_STATECHANGE on <li#option1> role=ROLE_SYSTEM_LISTITEM name="Apple" SELECTED,FOCUSED,FOCUSABLE,SELECTABLE PosInSet=1 SetSize=3
EVENT_OBJECT_STATECHANGE on <li#option1> role=ROLE_SYSTEM_LISTITEM name="Apple" SELECTED,FOCUSABLE,SELECTABLE PosInSet=1 SetSize=3
IA2_EVENT_ACTIVE_DESCENDANT_CHANGED on <input> role=ROLE_SYSTEM_COMBOBOX EXPANDED,FOCUSABLE,HASPOPUP IA2_STATE_EDITABLE,IA2_STATE_SELECTABLE_TEXT,IA2_STATE_SINGLE_LINE,IA2_STATE_SUPPORTS_AUTOCOMPLETION
FOCUS-EVENT role=ROLE_LIST_ITEM name='Orange' ENABLED,FOCUSABLE,FOCUSED,SELECTABLE,SELECTED,SENSITIVE,SHOWING,VISIBLE
SELECTION-CHANGED role=ROLE_LIST_BOX name='(null)' ENABLED,SENSITIVE,SHOWING,VERTICAL,VISIBLE
STATE-CHANGE:FOCUSED:TRUE role=ROLE_LIST_ITEM name='Orange' ENABLED,FOCUSABLE,FOCUSED,SELECTABLE,SELECTED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:SELECTED:TRUE role=ROLE_LIST_ITEM name='Orange' ENABLED,FOCUSABLE,FOCUSED,SELECTABLE,SELECTED,SENSITIVE,SHOWING,VISIBLE
=== Start Continuation ===
FOCUS-EVENT role=ROLE_LIST_ITEM name='Banana' ENABLED,FOCUSABLE,FOCUSED,SELECTABLE,SELECTED,SENSITIVE,SHOWING,VISIBLE
FOCUS-EVENT role=ROLE_LIST_ITEM name='Orange' ENABLED,FOCUSABLE,SELECTABLE,SENSITIVE,SHOWING,VISIBLE
SELECTION-CHANGED role=ROLE_LIST_BOX name='(null)' ENABLED,SENSITIVE,SHOWING,VERTICAL,VISIBLE
STATE-CHANGE:FOCUSED:FALSE role=ROLE_LIST_ITEM name='Orange' ENABLED,FOCUSABLE,SELECTABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:FOCUSED:TRUE role=ROLE_LIST_ITEM name='Banana' ENABLED,FOCUSABLE,FOCUSED,SELECTABLE,SELECTED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:SELECTED:FALSE role=ROLE_LIST_ITEM name='Orange' ENABLED,FOCUSABLE,SELECTABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:SELECTED:TRUE role=ROLE_LIST_ITEM name='Banana' ENABLED,FOCUSABLE,FOCUSED,SELECTABLE,SELECTED,SENSITIVE,SHOWING,VISIBLE
AXSelectedChildrenChanged on AXComboBox
AXSelectedChildrenChanged on AXList
=== Start Continuation ===
AXSelectedChildrenChanged on AXComboBox
AXSelectedChildrenChanged on AXList
AriaProperties changed on role=option, name=Apple
AriaProperties changed on role=option, name=Orange
AutomationFocusChanged on role=option, name=Orange
SelectionItem_ElementSelected on role=option, name=Orange
=== Start Continuation ===
AriaProperties changed on role=option, name=Banana
AriaProperties changed on role=option, name=Orange
AutomationFocusChanged on role=option, name=Banana
SelectionItem_ElementSelected on role=option, name=Banana
EVENT_OBJECT_FOCUS on <li#option2> role=ROLE_SYSTEM_LISTITEM name="Orange" SELECTED,FOCUSED,FOCUSABLE,SELECTABLE PosInSet=2 SetSize=3
EVENT_OBJECT_SELECTION on <li#option2> role=ROLE_SYSTEM_LISTITEM name="Orange" SELECTED,FOCUSED,FOCUSABLE,SELECTABLE PosInSet=2 SetSize=3
EVENT_OBJECT_SELECTIONWITHIN on <ul#list> role=ROLE_SYSTEM_LIST IA2_STATE_VERTICAL SetSize=3
EVENT_OBJECT_STATECHANGE on <li#option1> role=ROLE_SYSTEM_LISTITEM name="Apple" FOCUSED,FOCUSABLE,SELECTABLE PosInSet=1 SetSize=3
EVENT_OBJECT_STATECHANGE on <li#option2> role=ROLE_SYSTEM_LISTITEM name="Orange" SELECTED,FOCUSABLE,SELECTABLE PosInSet=2 SetSize=3
IA2_EVENT_ACTIVE_DESCENDANT_CHANGED on <input> role=ROLE_SYSTEM_COMBOBOX EXPANDED,FOCUSABLE,HASPOPUP IA2_STATE_EDITABLE,IA2_STATE_SELECTABLE_TEXT,IA2_STATE_SINGLE_LINE,IA2_STATE_SUPPORTS_AUTOCOMPLETION
=== Start Continuation ===
EVENT_OBJECT_FOCUS on <li#option3> role=ROLE_SYSTEM_LISTITEM name="Banana" SELECTED,FOCUSED,FOCUSABLE,SELECTABLE PosInSet=3 SetSize=3
EVENT_OBJECT_SELECTION on <li#option3> role=ROLE_SYSTEM_LISTITEM name="Banana" SELECTED,FOCUSED,FOCUSABLE,SELECTABLE PosInSet=3 SetSize=3
EVENT_OBJECT_SELECTIONWITHIN on <ul#list> role=ROLE_SYSTEM_LIST IA2_STATE_VERTICAL SetSize=3
EVENT_OBJECT_STATECHANGE on <li#option3> role=ROLE_SYSTEM_LISTITEM name="Banana" SELECTED,FOCUSED,FOCUSABLE,SELECTABLE PosInSet=3 SetSize=3
EVENT_OBJECT_STATECHANGE on <li#option2> role=ROLE_SYSTEM_LISTITEM name="Orange" FOCUSED,FOCUSABLE,SELECTABLE PosInSet=2 SetSize=3
EVENT_OBJECT_STATECHANGE on <li#option3> role=ROLE_SYSTEM_LISTITEM name="Banana" SELECTED,FOCUSABLE,SELECTABLE PosInSet=3 SetSize=3
IA2_EVENT_ACTIVE_DESCENDANT_CHANGED on <input> role=ROLE_SYSTEM_COMBOBOX EXPANDED,FOCUSABLE,HASPOPUP IA2_STATE_EDITABLE,IA2_STATE_SELECTABLE_TEXT,IA2_STATE_SINGLE_LINE,IA2_STATE_SUPPORTS_AUTOCOMPLETION
<!DOCTYPE html>
<html>
<body>
<input role="combobox" type="search" aria-expanded="true" aria-haspopup="true"
aria-autocomplete="list" aria-activedescendant="option2" aria-owns="list">
<ul id="list" role="listbox">
<li id="option1" role="option">Apple</li>
<li id="option2" role="option">Orange</li>
<li id="option3" role="option">Banana</li>
</ul>
<script>
document.querySelector('input').focus();
function go() {
var combo_box = document.querySelector('input');
combo_box.setAttribute('aria-activedescendant', 'option3');
}
</script>
<input role="combobox" type="search" aria-expanded="true" aria-haspopup="true" aria-autocomplete="list"
aria-activedescendant="option1" aria-owns="list">
<ul id="list" role="listbox">
<li id="option1" role="option">Apple</li>
<li id="option2" role="option">Orange</li>
<li id="option3" role="option">Banana</li>
</ul>
<script>
document.querySelector('input').focus();
var option = 2;
function go() {
var combo_box = document.querySelector('input');
combo_box.setAttribute('aria-activedescendant', 'option' + option);
return option++ < 3;
}
</script>
</body>
</html>
......@@ -1184,8 +1184,11 @@ void AXObjectCacheImpl::HandleAriaSelectedChangedWithCleanLayout(Node* node) {
PostNotification(obj, ax::mojom::Event::kCheckedStateChanged);
AXObject* listbox = obj->ParentObjectUnignored();
if (listbox && listbox->RoleValue() == ax::mojom::Role::kListBox)
if (listbox && listbox->RoleValue() == ax::mojom::Role::kListBox) {
// Ensure listbox options are in sync as selection status may have changed
MarkAXObjectDirty(listbox, true);
PostNotification(listbox, ax::mojom::Event::kSelectedChildrenChanged);
}
}
void AXObjectCacheImpl::HandleNodeLostFocusWithCleanLayout(Node* node) {
......
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