Commit 6d04fdfe authored by Jessica Tallon's avatar Jessica Tallon Committed by Commit Bot

Only apply "unlabled image" roledescription a11y attribute on images

The roledescription accessibility attribute was being set on kLinks
and kRootWebArea. This can cause screen readers to announce the item
as "unlabled image" which is misleading when it's not an image. This
removes adding that attribute on anything but images to avoid
confusion.

Bug: 998232
Change-Id: Ic11c3f02a7f439eabcf727f4d4fb08181e196ef5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1834345Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Jessica Tallon <jtallon@igalia.com>
Cr-Commit-Position: refs/heads/master@{#709486}
parent 7f4f9dbc
...@@ -497,10 +497,11 @@ base::string16 AXPlatformNodeBase::GetRangeValueText() const { ...@@ -497,10 +497,11 @@ base::string16 AXPlatformNodeBase::GetRangeValueText() const {
base::string16 base::string16
AXPlatformNodeBase::GetRoleDescriptionFromImageAnnotationStatusOrFromAttribute() AXPlatformNodeBase::GetRoleDescriptionFromImageAnnotationStatusOrFromAttribute()
const { const {
if (GetData().GetImageAnnotationStatus() == if (GetData().role == ax::mojom::Role::kImage &&
ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation || (GetData().GetImageAnnotationStatus() ==
GetData().GetImageAnnotationStatus() == ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation ||
ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation) { GetData().GetImageAnnotationStatus() ==
ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation)) {
return GetDelegate()->GetLocalizedRoleDescriptionForUnlabeledImage(); return GetDelegate()->GetLocalizedRoleDescriptionForUnlabeledImage();
} }
......
...@@ -2688,10 +2688,12 @@ TEST_F(AXPlatformNodeWinTest, TestUnlabeledImageRoleDescription) { ...@@ -2688,10 +2688,12 @@ TEST_F(AXPlatformNodeWinTest, TestUnlabeledImageRoleDescription) {
tree.nodes[1].id = 2; tree.nodes[1].id = 2;
tree.nodes[1].SetImageAnnotationStatus( tree.nodes[1].SetImageAnnotationStatus(
ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation); ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation);
tree.nodes[1].role = ax::mojom::Role::kImage;
tree.nodes[2].id = 3; tree.nodes[2].id = 3;
tree.nodes[2].SetImageAnnotationStatus( tree.nodes[2].SetImageAnnotationStatus(
ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation); ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation);
tree.nodes[2].role = ax::mojom::Role::kImage;
Init(tree); Init(tree);
ComPtr<IAccessible> root_obj(GetRootIAccessible()); ComPtr<IAccessible> root_obj(GetRootIAccessible());
...@@ -2722,10 +2724,12 @@ TEST_F(AXPlatformNodeWinTest, TestUnlabeledImageAttributes) { ...@@ -2722,10 +2724,12 @@ TEST_F(AXPlatformNodeWinTest, TestUnlabeledImageAttributes) {
tree.nodes[1].id = 2; tree.nodes[1].id = 2;
tree.nodes[1].SetImageAnnotationStatus( tree.nodes[1].SetImageAnnotationStatus(
ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation); ax::mojom::ImageAnnotationStatus::kEligibleForAnnotation);
tree.nodes[1].role = ax::mojom::Role::kImage;
tree.nodes[2].id = 3; tree.nodes[2].id = 3;
tree.nodes[2].SetImageAnnotationStatus( tree.nodes[2].SetImageAnnotationStatus(
ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation); ax::mojom::ImageAnnotationStatus::kSilentlyEligibleForAnnotation);
tree.nodes[2].role = ax::mojom::Role::kImage;
Init(tree); Init(tree);
ComPtr<IAccessible> root_obj(GetRootIAccessible()); ComPtr<IAccessible> root_obj(GetRootIAccessible());
......
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