Skip to content

Commit

Permalink
Update aria-expanded state when popover invokers are clicked
Browse files Browse the repository at this point in the history
The prior code wasn't notifying the AX system that the state was
dirty when an invoker button was pressed. Now that's being done.
Also add an events test to check this, and remove an extra
expectation file that wasn't needed.

Fixed: 1418739
Change-Id: I09cf6560dbefe65b5ffc68cc363f48c4a8131909
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4316483
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Mason Freed <masonf@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1115980}
  • Loading branch information
Mason Freed authored and Chromium LUCI CQ committed Mar 10, 2023
1 parent f541f77 commit d64a498
Show file tree
Hide file tree
Showing 24 changed files with 243 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,12 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
RunEventTest(FILE_PATH_LITERAL("expanded-changed.html"));
}

// TODO(crbug.com/1423530): disabled on UIA.
IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTestExceptUIA,
AccessibilityEventsPopoverExpandedChanged) {
RunEventTest(FILE_PATH_LITERAL("popover-expanded-changed.html"));
}

// crbug.com/1047282: disabled due to flakiness.
IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
DISABLED_AccessibilityEventsFormRequiredChanged) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,16 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityPopoverApi) {
RunHtmlTest(FILE_PATH_LITERAL("popover-api.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest,
AccessibilityPopoverExpanded) {
RunHtmlTest(FILE_PATH_LITERAL("popover-expanded.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest,
AccessibilityPopoverCollapsed) {
RunHtmlTest(FILE_PATH_LITERAL("popover-collapsed.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityPre) {
RunHtmlTest(FILE_PATH_LITERAL("pre.html"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,13 @@ public void test_expandedChanged() {
performTest("expanded-changed.html", EMPTY_EXPECTATIONS_FILE);
}

@Test
@SmallTest
public void test_popoverExpandedChanged() {
performTest(
"popover-expanded-changed.html", "popover-expanded-changed-expected-android.txt");
}

@Test
@SmallTest
@DisabledTest(message = "https://crbug.com/1190218")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,18 @@ public void test_picture() {
performHtmlTest("picture.html");
}

@Test
@SmallTest
public void test_popoverExpanded() {
performHtmlTest("popover-expanded.html");
}

@Test
@SmallTest
public void test_popoverCollapsed() {
performHtmlTest("popover-collapsed.html");
}

@Test
@SmallTest
public void test_portalWithWidgetInside() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TYPE_VIEW_CLICKED
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
CHILDREN-CHANGED:ADD index:3 CHILD:(role=ROLE_PANEL) role=ROLE_SECTION ENABLED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Hide button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Show button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Toggle button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
=== Start Continuation ===
CHILDREN-CHANGED:REMOVE index:3 CHILD:(role=ROLE_PANEL) role=ROLE_SECTION ENABLED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Hide button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Show button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Toggle button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
=== Start Continuation ===
CHILDREN-CHANGED:ADD index:3 CHILD:(role=ROLE_PANEL) role=ROLE_SECTION ENABLED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Hide button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Show button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Toggle button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
=== Start Continuation ===
CHILDREN-CHANGED:REMOVE index:3 CHILD:(role=ROLE_PANEL) role=ROLE_SECTION ENABLED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Hide button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Show button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Toggle button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
=== Start Continuation ===
CHILDREN-CHANGED:ADD index:3 CHILD:(role=ROLE_PANEL) role=ROLE_SECTION ENABLED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Hide button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Show button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:TRUE role=ROLE_PUSH_BUTTON name='Toggle button' ENABLED,EXPANDABLE,EXPANDED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
=== Start Continuation ===
CHILDREN-CHANGED:REMOVE index:3 CHILD:(role=ROLE_PANEL) role=ROLE_SECTION ENABLED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Hide button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Show button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:EXPANDED:FALSE role=ROLE_PUSH_BUTTON name='Toggle button' ENABLED,EXPANDABLE,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
AXExpandedChanged on AXButton AXTitle='Hide button'
AXExpandedChanged on AXButton AXTitle='Show button'
AXExpandedChanged on AXButton AXTitle='Toggle button'
=== Start Continuation ===
AXExpandedChanged on AXButton AXTitle='Hide button'
AXExpandedChanged on AXButton AXTitle='Show button'
AXExpandedChanged on AXButton AXTitle='Toggle button'
=== Start Continuation ===
AXExpandedChanged on AXButton AXTitle='Hide button'
AXExpandedChanged on AXButton AXTitle='Show button'
AXExpandedChanged on AXButton AXTitle='Toggle button'
=== Start Continuation ===
AXExpandedChanged on AXButton AXTitle='Hide button'
AXExpandedChanged on AXButton AXTitle='Show button'
AXExpandedChanged on AXButton AXTitle='Toggle button'
=== Start Continuation ===
AXExpandedChanged on AXButton AXTitle='Hide button'
AXExpandedChanged on AXButton AXTitle='Show button'
AXExpandedChanged on AXButton AXTitle='Toggle button'
=== Start Continuation ===
AXExpandedChanged on AXButton AXTitle='Hide button'
AXExpandedChanged on AXButton AXTitle='Show button'
AXExpandedChanged on AXButton AXTitle='Toggle button'
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
@UIA-WIN-DENY:*
@UIA-WIN-ALLOW:ExpandCollapse*
@UIA-WIN-ALLOW:AriaProperties*
-->
<!DOCTYPE html>

<button id=toggle popovertarget=p>Toggle button</button>
<button id=show popovertarget=p popovertargetaction=show>Show button</button>
<button id=hide popovertarget=p popovertargetaction=hide>Hide button</button>
<div popover id=p>Popover</div>

<script>
var go_passes = [
() => toggle.click(),
() => toggle.click(),
() => show.click(),
() => hide.click(),
() => show.click(),
() => hide.click(),
];

let current_pass = 0;
function go() {
go_passes[current_pass++].call();
return current_pass < go_passes.length;
}
</script>
33 changes: 0 additions & 33 deletions content/test/data/accessibility/html/popover-api-expected

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
++[static] name='Text input pointing to invalid popover value'
++[paragraph]
++++[static] name='Showing/visible popovers below'
++[push button] name='Button pointing to showing popover' details details-roles:popover
++[push button] name='Button pointing to showing popover' expanded details details-roles:popover
++[entry] selectable-text
++[static] name='Tel input pointing to showing popover '
++[push button] name='Show button pointing to nested popover' details details-roles:popover
++[push button] name='Show button pointing to nested popover' expanded details details-roles:popover
++[entry] selectable-text
++[static] name='Url input pointing to nested popover '
++[panel] details-for
Expand All @@ -30,4 +30,4 @@
++[static] name='Url input pointing to showing manual '
++[push button] name='Hide button pointing to showing manual (should NOT add aria-details)'
++[panel] details-for
++++[static] name='Manual (showing)'
++++[static] name='Manual (showing)'
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ rootWebArea
++++++paragraph
++++++++staticText name='Showing/visible popovers below'
++++++++++inlineTextBox name='Showing/visible popovers below'
++++++button name='Button pointing to showing popover' detailsIds=group
++++++button expanded name='Button pointing to showing popover' detailsIds=group
++++++++staticText name='Button pointing to showing popover'
++++++++++inlineTextBox name='Button pointing to showing popover'
++++++textField
++++++++genericContainer
++++++staticText name='Tel input pointing to showing popover '
++++++++inlineTextBox name='Tel input pointing to showing popover '
++++++button name='Show button pointing to nested popover' detailsIds=group
++++++button expanded name='Show button pointing to nested popover' detailsIds=group
++++++++staticText name='Show button pointing to nested popover'
++++++++++inlineTextBox name='Show button pointing to nested popover'
++++++textField
Expand All @@ -86,4 +86,4 @@ rootWebArea
++++++++++inlineTextBox name='Hide button pointing to showing manual (should NOT add aria-details)'
++++++group ispopup=manual
++++++++staticText name='Manual (showing)'
++++++++++inlineTextBox name='Manual (showing)'
++++++++++inlineTextBox name='Manual (showing)'
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AXWebArea
++AXButton AXTitle='Button pointing to hidden popover'
++AXButton AXExpanded=0 AXTitle='Button pointing to hidden popover'
++AXTextField
++AXStaticText AXValue='Text input pointing to hidden popover '
++AXButton AXTitle='Hide button pointing to hidden manual'
Expand All @@ -15,10 +15,10 @@ AXWebArea
++AXStaticText AXValue='Text input pointing to invalid popover value'
++AXGroup
++++AXStaticText AXValue='Showing/visible popovers below'
++AXButton AXTitle='Button pointing to showing popover'
++AXButton AXExpanded=1 AXTitle='Button pointing to showing popover'
++AXTextField
++AXStaticText AXValue='Tel input pointing to showing popover '
++AXButton AXTitle='Show button pointing to nested popover'
++AXButton AXExpanded=1 AXTitle='Show button pointing to nested popover'
++AXTextField
++AXStaticText AXValue='Url input pointing to nested popover '
++AXGroup AXSubrole=AXApplicationGroup
Expand All @@ -30,4 +30,4 @@ AXWebArea
++AXStaticText AXValue='Url input pointing to showing manual '
++AXButton AXTitle='Hide button pointing to showing manual (should NOT add aria-details)'
++AXGroup AXSubrole=AXApplicationGroup
++++AXStaticText AXValue='Manual (showing)'
++++AXStaticText AXValue='Manual (showing)'
8 changes: 8 additions & 0 deletions content/test/data/accessibility/html/popover-api.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<!--
@MAC-ALLOW:AXExpanded
@WIN-ALLOW:details-roles*
@WIN-ALLOW:EXPANDED*
@WIN-ALLOW:HASPOPUP*
@WIN-ALLOW:haspopup*
@BLINK-ALLOW:haspopup*
@BLINK-ALLOW:expanded*
@AURALINUX-ALLOW:details-roles*
@AURALINUX-ALLOW:expanded*
@AURALINUX-ALLOW:haspopup:*
-->
<div popover>Div popover</div>
<ul popover role=listbox><li>Listbox role on ul</li></ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WebView focusable focused scrollable actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="rootWebArea"]
++View actions:[AX_FOCUS] bundle:[chromeRole="genericContainer"]
++++Button text:"Will collapse" viewIdResName:"toggle" clickable focusable actions:[FOCUS, CLICK, AX_FOCUS, NEXT, PREVIOUS, COLLAPSE] bundle:[chromeRole="button", clickableScore="300", roleDescription="button"]
++++View text:"Popover" viewIdResName:"will-collapse" actions:[AX_FOCUS, NEXT, PREVIOUS] bundle:[chromeRole="group"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rootWebArea name='done'
++genericContainer ignored
++++genericContainer
++++++button collapsed name='Will collapse'
++++++++staticText name='Will collapse'
++++++++++inlineTextBox name='Will collapse'
++++++genericContainer ignored invisible
++++++++staticText ignored invisible name='Popover'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AXWebArea AXTitle='done'
++AXGroup
++++AXButton AXTitle='Will collapse'
20 changes: 20 additions & 0 deletions content/test/data/accessibility/html/popover-collapsed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
@WAIT-FOR:done
-->

<!DOCTYPE html>

<button id=toggle popovertarget="will-collapse">Will collapse</button>
<div popover id="will-collapse">Popover</div>

<script>
document.getElementById('toggle').click(); // Start expanded.
document.addEventListener('DOMContentLoaded', () => {
setTimeout(() => {
document.getElementById('toggle').click();
setTimeout(() => {
document.title = 'done';
}, 20);
}, 250);
});
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
WebView focusable focused scrollable actions:[CLEAR_FOCUS, AX_FOCUS] bundle:[chromeRole="rootWebArea"]
++View actions:[AX_FOCUS] bundle:[chromeRole="genericContainer"]
++++Button text:"Will expand" viewIdResName:"toggle" clickable focusable actions:[FOCUS, CLICK, AX_FOCUS, NEXT, PREVIOUS, EXPAND] bundle:[chromeRole="button", clickableScore="300", roleDescription="button"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rootWebArea name='done'
++genericContainer ignored
++++genericContainer
++++++button expanded name='Will expand'
++++++++staticText name='Will expand'
++++++++++inlineTextBox name='Will expand'
++++++group ispopup=auto
++++++++staticText name='Popover'
++++++++++inlineTextBox name='Popover'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
AXWebArea AXTitle='done'
++AXGroup
++++AXButton AXTitle='Will expand'
++++AXGroup AXSubrole=AXApplicationGroup
++++++AXStaticText AXValue='Popover'
20 changes: 20 additions & 0 deletions content/test/data/accessibility/html/popover-expanded.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
@BLINK-ALLOW:expanded*
@WAIT-FOR:done
-->

<!DOCTYPE html>

<button id=toggle popovertarget="will-expand">Will expand</button>
<div popover id="will-expand">Popover</div>

<script>
document.addEventListener('DOMContentLoaded', () => {
setTimeout(() => {
document.getElementById('toggle').click();
setTimeout(() => {
document.title = 'done';
}, 20);
}, 250);
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ class CORE_EXPORT AXObjectCache : public GarbageCollected<AXObjectCache> {
base::TimeDelta timeout,
ui::AXTreeUpdate*) = 0;

virtual void MarkElementDirty(const Node*) = 0;

virtual void MarkAllImageAXObjectsDirty() = 0;

// Notifies that an AXObject is dirty and its state needs
Expand Down

0 comments on commit d64a498

Please sign in to comment.