Skip to content

Commit

Permalink
UIA: Fire UIA_AriaPropertiesPropertyId event, part 4/5
Browse files Browse the repository at this point in the history
- Implemented firing property changed event for
  UIA_AriaPropertiesPropertyId and associated unit and
  browser dump tests for the following AriaProperties:
   - posinset
   - pressed
   - readonly
   - relevant

- Added dump test for testing when multiple aria
  attributes of one element change at once to test
  the logic for consolidating
  UIA_AriaPropertiesPropertyId events introduced in
  part 1 (CL:1574834)

- Modified comments on expected behaviors for various
  aria-*-changed.html dump test files.

- Breakdown of UI Automation AriaProperties need to be
  implemented:
  atomic [part 1]
  busy [part 1]
  channel [part 2]
  checked [part 1]
  disabled [part 3]
  dropeffect [part 2]
  expanded [part 1]
  grabbed [part 2]
  haspopup [part 1]
  hidden [not implemented]
  invalid [part 1]
  level [part 3]
  live [part 3]
  multiline [part 1]
  multiselectable [part 3]
  posinset [part 4, this cl]
  pressed [part 4, this cl]
  readonly [part 4, this cl]
  relevant [part 4, this cl]
  required [part 1]
  secret [part 2]
  selected [part 1]
  setsize [part 5]
  sort [part 5]
  tabindex [part 2]
  valuemax [part 5]
  valuemin [part 5]
  valuenow [part 5]
  valuetext [part 5]

- Documentation on UI Automation AriaProperties
(see the second table's last column for AriaProperties
properties):
https://docs.microsoft.com/en-us/windows/desktop/WinAuto/uiauto-ariaspecification

- Link to part 1, UIA: Fire UIA_AriaPropertiesPropertyId event:
  CL:1574834

- Link to part 2, UIA: Fire UIA_AriaPropertiesPropertyId event:
  CL:1576280

- Link to part 3, UIA: Fire UIA_AriaPropertiesPropertyId event:
  CL:1589100

- Link to part 4, UIA: Fire UIA_AriaPropertiesPropertyId event:
  CL:1592640

- Link to part 5, UIA: Fire UIA_AriaPropertiesPropertyId event:
  CL:1591487

Bug: 928949

Change-Id: Ica97e0a3afc850ad323bee25e6a778a073ac055f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1592640
Reviewed-by: Katie Dektar <katie@chromium.org>
Reviewed-by: Ian Prest <iapres@microsoft.com>
Commit-Queue: Victor Fei <vicfei@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#659565}
  • Loading branch information
vicfei-ms authored and Commit Bot committed May 14, 2019
1 parent 925d26e commit 4a4d3e2
Show file tree
Hide file tree
Showing 24 changed files with 256 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ void BrowserAccessibilityManagerAndroid::FireGeneratedEvent(
case ui::AXEventGenerator::Event::LAYOUT_INVALIDATED:
case ui::AXEventGenerator::Event::LIVE_REGION_CHANGED:
case ui::AXEventGenerator::Event::LIVE_REGION_CREATED:
case ui::AXEventGenerator::Event::LIVE_RELEVANT_CHANGED:
case ui::AXEventGenerator::Event::LIVE_STATUS_CHANGED:
case ui::AXEventGenerator::Event::LOAD_START:
case ui::AXEventGenerator::Event::MENU_ITEM_SELECTED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ void PostAnnouncementNotification(NSString* announcement) {
case ui::AXEventGenerator::Event::LANGUAGE_CHANGED:
case ui::AXEventGenerator::Event::LAYOUT_INVALIDATED:
case ui::AXEventGenerator::Event::LIVE_REGION_NODE_CHANGED:
case ui::AXEventGenerator::Event::LIVE_RELEVANT_CHANGED:
case ui::AXEventGenerator::Event::LIVE_STATUS_CHANGED:
case ui::AXEventGenerator::Event::LOAD_START:
case ui::AXEventGenerator::Event::MULTILINE_STATE_CHANGED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ void BrowserAccessibilityManagerWin::FireGeneratedEvent(
case ui::AXEventGenerator::Event::LAYOUT_INVALIDATED:
FireUiaAccessibilityEvent(UIA_LayoutInvalidatedEventId, node);
break;
case ui::AXEventGenerator::Event::LIVE_RELEVANT_CHANGED:
case ui::AXEventGenerator::Event::MULTILINE_STATE_CHANGED:
aria_properties_events_.insert(node);
break;
Expand All @@ -297,12 +298,14 @@ void BrowserAccessibilityManagerWin::FireGeneratedEvent(
break;
case ui::AXEventGenerator::Event::POSITION_IN_SET_CHANGED:
FireUiaPropertyChangedEvent(UIA_PositionInSetPropertyId, node);
aria_properties_events_.insert(node);
break;
case ui::AXEventGenerator::Event::READONLY_CHANGED:
if (ui::IsRangeValueSupported(node->GetData()))
FireUiaPropertyChangedEvent(UIA_RangeValueIsReadOnlyPropertyId, node);
else if (ui::IsValuePatternSupported(node))
FireUiaPropertyChangedEvent(UIA_ValueIsReadOnlyPropertyId, node);
aria_properties_events_.insert(node);
break;
case ui::AXEventGenerator::Event::REQUIRED_STATE_CHANGED:
FireUiaPropertyChangedEvent(UIA_IsRequiredForFormPropertyId, node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,21 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
RunEventTest(FILE_PATH_LITERAL("aria-multiline-changed.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsAriaPosinsetChanged) {
RunEventTest(FILE_PATH_LITERAL("aria-posinset-changed.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsAriaReadonlyChanged) {
RunEventTest(FILE_PATH_LITERAL("aria-readonly-changed.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsAriaRelevantChanged) {
RunEventTest(FILE_PATH_LITERAL("aria-relevant-changed.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsAriaTreeCollapse) {
RunEventTest(FILE_PATH_LITERAL("aria-tree-collapse.html"));
Expand Down Expand Up @@ -534,6 +549,11 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
RunEventTest(FILE_PATH_LITERAL("menulist-popup.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsMultipleAriaPropertiesChanged) {
RunEventTest(FILE_PATH_LITERAL("multiple-aria-properties-changed.html"));
}

IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest,
AccessibilityEventsNameChange) {
RunEventTest(FILE_PATH_LITERAL("name-change.html"));
Expand Down
12 changes: 6 additions & 6 deletions content/test/data/accessibility/event/aria-atomic-changed.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
<button onclick="go()">go</button>
<script>
function go() {
// Set aria-atomic from default false->false; do not fire an event.
// Set aria-atomic from default false->false; should not fire an event.
document.getElementById('d1').setAttribute('aria-atomic', false);

// Set aria-atomic from true->false; fire an event.
// Set aria-atomic from true->false; should fire an event.
document.getElementById('d2').setAttribute('aria-atomic', false);

// Set aria-atomic from true->[removed]; fire an event.
// Set aria-atomic from true->[removed]; should fire an event.
document.getElementById('d3').removeAttribute('aria-atomic');

// Set aria-atomic from false->true; fire an event.
// Set aria-atomic from false->true; should fire an event.
document.getElementById('d4').setAttribute('aria-atomic', true);

// Set aria-atomic from false->true on a non-live region; do not fire an
// event.
// Set aria-atomic from false->true on a non-live region;
// should not fire an event.
document.getElementById('d5').setAttribute('aria-atomic', true);
}
</script>
Expand Down
24 changes: 16 additions & 8 deletions content/test/data/accessibility/event/aria-haspopup-changed.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,36 @@
<input id="input7" aria-label="input7" role="combobox" aria-haspopup="true">
<script>
function go() {
// Set aria-haspopup from combobox default(listbox)->listbox, do not fire an event.
// Set aria-haspopup from combobox default(listbox)->listbox;
// should not fire an event.
document.getElementById('input0').setAttribute('aria-haspopup', 'listbox');

// Set aria-haspopup from combobox default(listbox, false)->false; fire an event.
// Set aria-haspopup from combobox default(listbox, false)->false;
// should fire an event.
document.getElementById('input1').setAttribute('aria-haspopup', 'false');

// Set aria-haspopup from combobox default(listbox)->true(menu); fire an event.
// Set aria-haspopup from combobox default(listbox)->true(menu);
// should fire an event.
document.getElementById('input2').setAttribute('aria-haspopup', 'true');

// Set aria-haspopup from combobox default(listbox)->menu; fire an event.
// Set aria-haspopup from combobox default(listbox)->menu;
// should fire an event.
document.getElementById('input3').setAttribute('aria-haspopup', 'menu');

// Set aria-haspopup from combobox default(listbox)->tree; fire an event.
// Set aria-haspopup from combobox default(listbox)->tree;
// should fire an event.
document.getElementById('input4').setAttribute('aria-haspopup', 'tree');

// Set aria-haspopup from combobox default(listbox)->grid; fire an event.
// Set aria-haspopup from combobox default(listbox)->grid;
// should fire an event.
document.getElementById('input5').setAttribute('aria-haspopup', 'grid');

// Set aria-haspopup from combobox default(listbox)->dialog; fire an event.
// Set aria-haspopup from combobox default(listbox)->dialog;
// should fire an event.
document.getElementById('input6').setAttribute('aria-haspopup', 'dialog');

// Remove aria-haspopup. Set aria-haspopup from true(menu)->default(listbox); fire an event.
// Remove aria-haspopup. Set aria-haspopup from true(menu)->default(listbox);
// should fire an event.
document.getElementById('input7').removeAttribute('aria-haspopup');
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<input id="field3" aria-label="field3">
<script>
function go() {
// Set aria-invalid from default false->false, no event is fired.
// Set aria-invalid from default false->false; should not fire an event.
document.getElementById('field0').setAttribute('aria-invalid', 'false');

// Set aria-invalid from true->false; fire an event.
// Set aria-invalid from true->false; should fire an event.
document.getElementById('field1').setAttribute('aria-invalid', 'false');

// Set aria-invalid from true->[removed]; fire an event.
// Set aria-invalid from true->[removed]; should fire an event.
document.getElementById('field2').removeAttribute('aria-invalid');

// Set aria-invalid from false->true; fire an event.
// Set aria-invalid from false->true; should fire an event.
document.getElementById('field3').setAttribute('aria-invalid', 'true');
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<input id="input3" aria-label="input3" role="textbox">
<script>
function go() {
// Set aria-multiline from default false->false, no event is fired.
// Set aria-multiline from default false->false; should not fire an event.
document.getElementById('input0').setAttribute('aria-multiline', 'false');

// Set aria-multiline from true->false; fire an event.
// Set aria-multiline from true->false; should fire an event.
document.getElementById('input1').setAttribute('aria-multiline', 'false');

// Set aria-multiline from true->[removed]; fire an event.
// Set aria-multiline from true->[removed]; should fire an event.
document.getElementById('input2').removeAttribute('aria-multiline');

// Set aria-multiline from false->true; fire an event.
// Set aria-multiline from false->true; should fire an event.
document.getElementById('input3').setAttribute('aria-multiline', 'true');
}
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AriaProperties changed on role=option, name=Li1
AriaProperties changed on role=option, name=Li2
PositionInSet changed on role=option, name=Li1
PositionInSet changed on role=option, name=Li2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AriaProperties changed on role=option, name=Li1
AriaProperties changed on role=option, name=Li2
22 changes: 22 additions & 0 deletions content/test/data/accessibility/event/aria-posinset-changed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<body>
<ul role="listbox">
<li id="li1" role="option">Li1</li>
<li id="li2" role="option" aria-posinset="2">Li2</li>
<li id="li3" role="option" aria-posinset="3">Li3</li>
</ul>
<script>
function go() {
// Set aria-posinset from default calculation '1'->'2'; should fire an event.
document.getElementById('li1').setAttribute('aria-posinset', '2');

// Set aria-posinset from '2'->[removed]; should fire an event.
document.getElementById('li2').removeAttribute('aria-posinset');

// Set aria-posinset from '3'->'3; should not fire an event.
document.getElementById('li3').setAttribute('aria-posinset', '3');
}
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AriaProperties changed on role=button, name=button1
AriaProperties changed on role=button, name=button2
ToggleToggleState changed on role=button, name=button1
ToggleToggleState changed on role=button, name=button2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AriaProperties changed on role=textbox, name=textarea2
AriaProperties changed on role=textbox, name=textarea3
AriaProperties changed on role=textbox, name=textarea4
ValueIsReadOnly changed on role=textbox, name=textarea2
ValueIsReadOnly changed on role=textbox, name=textarea3
ValueIsReadOnly changed on role=textbox, name=textarea4
29 changes: 29 additions & 0 deletions content/test/data/accessibility/event/aria-readonly-changed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
@UIA-WIN-DENY:*
@UIA-WIN-ALLOW:AriaProperties*
@UIA-WIN-ALLOW:ValueIsReadOnly*
-->
<!DOCTYPE html>
<html>
<body>
<textarea id="textarea1" aria-label="textarea1">Textarea1</textarea>
<textarea id="textarea2" aria-label="textarea2">Textarea2</textarea>
<textarea id="textarea3" aria-label="textarea3" aria-readonly="true">Textarea3</textarea>
<textarea id="textarea4" aria-label="textarea4" aria-readonly="true">Textarea4</textarea>
<script>
function go() {
// Set aria-readonly default false->false; should not fire an event.
document.getElementById('textarea1').setAttribute('aria-readonly', false);

// Set aria-readonly from false->true; should fire an event.
document.getElementById('textarea2').setAttribute('aria-readonly', true);

// Set aria-readonly from true->false; should fire an event.
document.getElementById('textarea3').setAttribute('aria-readonly', false);

// Set aria-readonly from true->[removed]; should fire an event.
document.getElementById('textarea4').removeAttribute('aria-readonly');
}
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AriaProperties changed on role=group, name=Div3
AriaProperties changed on role=group, name=Div4
AriaProperties changed on role=group, name=Div5
AriaProperties changed on role=group, name=Div6
AriaProperties changed on role=group, name=Div7
AriaProperties changed on role=group, name=Div8
52 changes: 52 additions & 0 deletions content/test/data/accessibility/event/aria-relevant-changed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!--
@UIA-WIN-DENY:*
@UIA-WIN-ALLOW:AriaProperties*
-->
<!DOCTYPE html>
<html>
<body>
<div id="d1" aria-label="Div1">Div1</div>
<div id="d2" aria-label="Div2" aria-live="polite">Div2</div>
<div id="d3" aria-label="Div3" aria-live="polite">Div3</div>
<div id="d4" aria-label="Div4" aria-live="polite">Div4</div>
<div id="d5" aria-label="Div5" aria-live="polite">Div5</div>
<div id="d6" aria-label="Div6" aria-live="polite">Div6</div>
<div id="d7" aria-label="Div7" aria-live="polite" aria-relevant="true">Div7</div>
<div id="d8" aria-label="Div8" aria-live="polite" aria-relevant="true">Div8</div>
<script>
function go() {
// Set aria-relevant from default 'additions text'->'all' on a non-live region;
// should not fire an event.
document.getElementById('d1').setAttribute('aria-relevant', 'all');

// Set aria-relevant from default 'additions text'->'additions text';
// should not fire an event.
document.getElementById('d2').setAttribute('aria-relevant', 'additions text');

// Set aria-relevant from default 'additions text'->'additions';
// should fire an event.
document.getElementById('d3').setAttribute('aria-relevant', 'additions');

// Set aria-relevant from default 'additions text'->'all';
// should fire an event.
document.getElementById('d4').setAttribute('aria-relevant', 'all');

// Set aria-relevant from default 'additions text'->'removals';
// should fire an event.
document.getElementById('d5').setAttribute('aria-relevant', 'removals');

// Set aria-relevant from default 'additions text'->'text';
// should fire an event.
document.getElementById('d6').setAttribute('aria-relevant', 'text');

// Set aria-relevant from 'additions'->'additions text';
// should fire an event.
document.getElementById('d7').setAttribute('aria-relevant', 'additions text');

// Set aria-relevant from 'additions'->[removed];
// should fire an event.
document.getElementById('d8').removeAttribute('aria-relevant');
}
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AriaProperties changed on role=checkbox, name=checkbox2
AriaProperties changed on role=checkbox, name=checkbox3
AriaProperties changed on role=checkbox, name=checkbox4
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
@UIA-WIN-DENY:*
@UIA-WIN-ALLOW:AriaProperties*
-->
<!DOCTYPE html>
<form>
<div aria-label="checkbox1" role="checkbox"></div>
<div aria-label="checkbox2" role="checkbox" aria-checked="false" aria-required="false" aria-readonly="false"></div>
<div aria-label="checkbox3" role="checkbox" aria-checked="true" aria-required="true" aria-readonly="true"></div>
<div aria-label="checkbox4" role="checkbox" aria-checked="true" aria-required="true" aria-readonly="true"></div>
</form>
<script>
function go() {
// Tests below modify multiple aria attributes on a single element at
// a time and the expected behavior is to fire UIA_AriaPropertiesPropertyId
// event once rather than multiple times.

// Multiple aria attributes change, default[false]->false;
// should not fire any event.
document.querySelector('div[aria-label=checkbox1]').setAttribute('aria-checked', false);
document.querySelector('div[aria-label=checkbox1]').setAttribute('aria-required', false);
document.querySelector('div[aria-label=checkbox1]').setAttribute('aria-readonly', false);

// Multiple aria attributes change, false->true;
// should fire only one event.
document.querySelector('div[aria-label=checkbox2]').setAttribute('aria-checked', true);
document.querySelector('div[aria-label=checkbox2]').setAttribute('aria-required', true);
document.querySelector('div[aria-label=checkbox2]').setAttribute('aria-readonly', true);

// Multiple aria attributes change, true->false;
// should fire only one event.
document.querySelector('div[aria-label=checkbox3]').setAttribute('aria-checked', false);
document.querySelector('div[aria-label=checkbox3]').setAttribute('aria-required', false);
document.querySelector('div[aria-label=checkbox3]').setAttribute('aria-readonly', false);

// Multiple aria attributes change, true->removed;
// should fire only one event.
document.querySelector('div[aria-label=checkbox4]').removeAttribute('aria-checked');
document.querySelector('div[aria-label=checkbox4]').removeAttribute('aria-required');
document.querySelector('div[aria-label=checkbox4]').removeAttribute('aria-readonly');
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ AriaProperties changed on role=slider
IsEnabled changed on role=slider
RangeValueIsReadOnly changed on role=slider
=== Start Continuation ===
AriaProperties changed on role=slider
RangeValueIsReadOnly changed on role=slider
=== Start Continuation ===
AriaProperties changed on role=slider
RangeValueIsReadOnly changed on role=slider
=== Start Continuation ===
AriaProperties changed on role=slider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ AriaProperties changed on role=textbox
IsEnabled changed on role=textbox
ValueIsReadOnly changed on role=textbox
=== Start Continuation ===
AriaProperties changed on role=textbox
ValueIsReadOnly changed on role=textbox
=== Start Continuation ===
AriaProperties changed on role=textbox
ValueIsReadOnly changed on role=textbox
=== Start Continuation ===
AriaProperties changed on role=textbox
ValueIsReadOnly changed on role=textbox
=== Start Continuation ===
AriaProperties changed on role=textbox
ValueIsReadOnly changed on role=textbox
=== Start Continuation ===
AriaProperties changed on role=textbox
Expand Down
Loading

0 comments on commit 4a4d3e2

Please sign in to comment.