Skip to content
Permalink
Browse files
AX: List size is still announced by VoiceOver despite use of aria-set…
…size=-1

https://bugs.webkit.org/show_bug.cgi?id=246426
rdar://101099199

Reviewed by Chris Fleizach.

Added test case to aria-setsize-posinset.html for aria-setsize = -1.

* LayoutTests/accessibility/aria-setsize-posinset-expected.txt:
* LayoutTests/accessibility/aria-setsize-posinset.html:

Canonical link: https://commits.webkit.org/256861@main
  • Loading branch information
AndresGonzalezApple committed Nov 19, 2022
1 parent d803c26 commit ca1977fd4ef6781d33ab200c61f446550f7c6fdb
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 49 deletions.
@@ -1,23 +1,22 @@
This tests verifies that aria-posinset and aria-setsize are exposed to accessibility correctly.


Verify that the first item in the list exposes setsize and posinset attributes.
PASS: firstListItem.isAttributeSupported('AXARIASetSize') === true
PASS: firstListItem.isAttributeSupported('AXARIAPosInSet') === true

Verify that the first item in the list returns the correct value for setsize and posinset.
PASS: firstListItem.numberAttributeValue('AXARIASetSize') === 100
PASS: firstListItem.numberAttributeValue('AXARIAPosInSet') === 3

This test verifies that aria-posinset and aria-setsize are exposed to accessibility correctly.

Verify that the list supports setsize.
PASS: axList.isAttributeSupported('AXARIASetSize') === true
Verify that the list returns the correct value for setsize.
PASS: axList.numberAttributeValue('AXARIASetSize') === 100
Verify that the first item in the list exposes posinset attributes.
PASS: axItem1.isAttributeSupported('AXARIAPosInSet') === true
PASS: axItem1.numberAttributeValue('AXARIAPosInSet') === 3
Verify that the second item in the list does not support setsize and posinset.
PASS: secondListItem.isAttributeSupported('AXARIASetSize') === false
PASS: secondListItem.isAttributeSupported('AXARIAPosInSet') === false

Updating aria-posinset to 4 for element #first-list-item.
PASS: firstListItem.numberAttributeValue('AXARIAPosInSet') === 4

Updating aria-setsize to 101 for element #first-list-item.
PASS: firstListItem.numberAttributeValue('AXARIASetSize') === 101
PASS: axItem2.isAttributeSupported('AXARIASetSize') === false
PASS: axItem2.isAttributeSupported('AXARIAPosInSet') === false
Update aria-posinset to 4 for the item1.
PASS: axItem1.numberAttributeValue('AXARIAPosInSet') === 4
Update aria-setsize to 101.
PASS: axList.numberAttributeValue('AXARIASetSize') === 101
Set aria-setsize to -1 and verify that the list still exposes the number of items.
PASS: axList.numberAttributeValue('AXARIASetSize') === -1
PASS: axList.isAttributeSupported('AXARIASetSize') === true

PASS successfullyParsed is true

@@ -6,49 +6,56 @@
</head>
<body>

<ul id="list">
<li id="first-list-item" aria-setsize="100" aria-posinset="3">3</li>
<li id="second-list-item">4</li>
<ul id="list" aria-setsize="100">
<li id="item1" aria-posinset="3">3</li>
<li id="item2">4</li>
</ul>

<script>
var testOutput = "This tests verifies that aria-posinset and aria-setsize are exposed to accessibility correctly.\n\n";
let output = "This test verifies that aria-posinset and aria-setsize are exposed to accessibility correctly.\n\n";

if (window.accessibilityController) {
window.jsTestIsAsync = true;

var firstListItem = accessibilityController.accessibleElementById("first-list-item");
var secondListItem = accessibilityController.accessibleElementById("second-list-item");
var axList = accessibilityController.accessibleElementById("list");
output += "Verify that the list supports setsize.\n";
output += expect("axList.isAttributeSupported('AXARIASetSize')", "true");
output += "Verify that the list returns the correct value for setsize.\n";
output += expect("axList.numberAttributeValue('AXARIASetSize')", "100");

testOutput += "\nVerify that the first item in the list exposes setsize and posinset attributes.\n";
testOutput += expect("firstListItem.isAttributeSupported('AXARIASetSize')", "true");
testOutput += expect("firstListItem.isAttributeSupported('AXARIAPosInSet')", "true");
var axItem1 = accessibilityController.accessibleElementById("item1");
var axItem2 = accessibilityController.accessibleElementById("item2");

testOutput += "\nVerify that the first item in the list returns the correct value for setsize and posinset.\n";
testOutput += expect("firstListItem.numberAttributeValue('AXARIASetSize')", "100");
testOutput += expect("firstListItem.numberAttributeValue('AXARIAPosInSet')", "3");
output += "Verify that the first item in the list exposes posinset attributes.\n";
output += expect("axItem1.isAttributeSupported('AXARIAPosInSet')", "true");
output += expect("axItem1.numberAttributeValue('AXARIAPosInSet')", "3");

testOutput += "\nVerify that the second item in the list does not support setsize and posinset.\n";
testOutput += expect("secondListItem.isAttributeSupported('AXARIASetSize')", "false");
testOutput += expect("secondListItem.isAttributeSupported('AXARIAPosInSet')", "false");
output += "Verify that the second item in the list does not support setsize and posinset.\n";
output += expect("axItem2.isAttributeSupported('AXARIASetSize')", "false");
output += expect("axItem2.isAttributeSupported('AXARIAPosInSet')", "false");

testOutput += "\nUpdating aria-posinset to 4 for element #first-list-item.\n";
document.getElementById("first-list-item").ariaPosInSet = "4";
output += "Update aria-posinset to 4 for the item1.\n";
item1.ariaPosInSet = "4";
setTimeout(async function() {
await waitFor(() => firstListItem.numberAttributeValue('AXARIAPosInSet') === 4);
testOutput += expect("firstListItem.numberAttributeValue('AXARIAPosInSet')", "4");

testOutput += "\nUpdating aria-setsize to 101 for element #first-list-item.\n";
document.getElementById("first-list-item").ariaSetSize = "101";
await waitFor(() => firstListItem.numberAttributeValue("AXARIASetSize") === 101);
testOutput += expect("firstListItem.numberAttributeValue('AXARIASetSize')", "101");

document.getElementById("list").style.visibility = 'hidden';
debug(testOutput);
await waitFor(() => axItem1.numberAttributeValue('AXARIAPosInSet') === 4);
output += expect("axItem1.numberAttributeValue('AXARIAPosInSet')", "4");

output += "Update aria-setsize to 101.\n";
list.ariaSetSize = "101";
await waitFor(() => axList.numberAttributeValue("AXARIASetSize") === 101);
output += expect("axList.numberAttributeValue('AXARIASetSize')", "101");

output += "Set aria-setsize to -1 and verify that the list still exposes the number of items.\n";
list.ariaSetSize = "-1";
await waitFor(() => axList.numberAttributeValue("AXARIASetSize") === -1);
output += expect("axList.numberAttributeValue('AXARIASetSize')", "-1");
output += expect("axList.isAttributeSupported('AXARIASetSize')", "true");

list.style.visibility = 'hidden';
debug(output);
finishJSTest();
}, 0);
}
</script>
</body>
</html>

@@ -2227,7 +2227,7 @@ bool AccessibilityObject::hasTagName(const QualifiedName& tagName) const
Node* node = this->node();
return is<Element>(node) && downcast<Element>(*node).hasTagName(tagName);
}

bool AccessibilityObject::hasAttribute(const QualifiedName& attribute) const
{
RefPtr element = this->element();
@@ -3006,7 +3006,7 @@ bool AccessibilityObject::supportsPosInSet() const
{
return hasAttribute(aria_posinsetAttr);
}

int AccessibilityObject::setSize() const
{
return getIntegralAttribute(aria_setsizeAttr);

0 comments on commit ca1977f

Please sign in to comment.