Skip to content

Commit

Permalink
8284662: [Win][Accessibility][ListCell] Screen reader fails to read L…
Browse files Browse the repository at this point in the history
…istView/ComboBox item count if > 100

Reviewed-by: kcr, aghaisas
  • Loading branch information
arapte committed Feb 17, 2023
1 parent 67c2b7a commit 21aa630
Showing 1 changed file with 29 additions and 0 deletions.
Expand Up @@ -105,6 +105,8 @@ final class WinAccessible extends Accessible {
private static final int UIA_ToggleToggleStatePropertyId = 30086;
private static final int UIA_AriaRolePropertyId = 30101;
private static final int UIA_ProviderDescriptionPropertyId = 30107;
private static final int UIA_PositionInSetPropertyId = 30152;
private static final int UIA_SizeOfSetPropertyId = 30153;
private static final int UIA_IsDialogPropertyId = 30174;

/* Control Pattern Identifiers */
Expand Down Expand Up @@ -836,6 +838,33 @@ private WinVariant GetPropertyValue(int propertyId) {
variant.boolVal = focus != null ? focus : false;
break;
}
case UIA_SizeOfSetPropertyId: {
AccessibleRole role = (AccessibleRole) getAttribute(ROLE);
if (role == AccessibleRole.LIST_ITEM) {
Accessible listAccessible = getContainer();
if (listAccessible != null) {
Integer count = (Integer)listAccessible.getAttribute(ITEM_COUNT);
if (count != 0) {
// Narrator misreads if count is 0; It reads two items at a time.
// Default value of UIA_SizeOfSetPropertyId is 0, so anyways
// returning 0 can be skipped.
variant = new WinVariant();
variant.vt = WinVariant.VT_I4;
variant.lVal = count;
}
}
}
break;
}
case UIA_PositionInSetPropertyId: {
AccessibleRole role = (AccessibleRole) getAttribute(ROLE);
if (role == AccessibleRole.LIST_ITEM) {
variant = new WinVariant();
variant.vt = WinVariant.VT_I4;
variant.lVal = (Integer)(getAttribute(INDEX)) + 1;
}
break;
}
case UIA_IsDialogPropertyId: {
AccessibleRole role = (AccessibleRole) getAttribute(ROLE);
variant = new WinVariant();
Expand Down

1 comment on commit 21aa630

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.