Commit 582ef42a authored by Wei Li's avatar Wei Li Committed by Commit Bot

Accessibility ignores images without alt text

For images without any alternative text, there is no point to add it
into the accessibility tree as it will only be recorded as an image.
We could safely ignore such image as it doesn't convey any extra
information.

One such case is the Chrome logo icon on HaTS bubble. We don't need to
link it into accessibility tree.

BUG=979530

Change-Id: I55d1dceb33f5d55241470a5cbd8ff66be9dca877
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1783672Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Wei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693802}
parent b32baee2
...@@ -32,8 +32,14 @@ void ImageViewBase::ResetImageSize() { ...@@ -32,8 +32,14 @@ void ImageViewBase::ResetImageSize() {
} }
void ImageViewBase::GetAccessibleNodeData(ui::AXNodeData* node_data) { void ImageViewBase::GetAccessibleNodeData(ui::AXNodeData* node_data) {
const base::string16& name = GetAccessibleName();
if (name.empty()) {
node_data->role = ax::mojom::Role::kIgnored;
return;
}
node_data->role = ax::mojom::Role::kImage; node_data->role = ax::mojom::Role::kImage;
node_data->SetName(GetAccessibleName()); node_data->SetName(name);
} }
void ImageViewBase::SetHorizontalAlignment(Alignment alignment) { void ImageViewBase::SetHorizontalAlignment(Alignment alignment) {
......
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