0

[a11y] Lower threshold for non-stopword image alt text to 3 characters

This commit lowers the threshold for image alt
text from 4 to 3 characters, but only for alt text
that is not composed primarily of stop words. This
means that images with alt text that is 3
characters or longer and contains non-stop words
will no longer be considered for automatic image
descriptions.

This change is being made in response to user
feedback that the previous threshold was too high
and was preventing some images with useful alt
text from being described. Because this change
only affects alt text containing non-stop words,
its impact is expected to be low.

Alternatives considered:

* Removing the threshold altogether. This was rejected because it could
  lead to generating image descriptions for images where they are not needed,
  potentially creating a confusing experience for users.

* Modifying the screen reader hint to provide different guidance when:
    * An image has no alt text at all (suggesting
      the use of the context menu to get a
      description).
    * An image has some alt text present
      (suggesting the use of the context menu for
      expanded image descriptions).

The following histograms will be used to track the impact of this change:

* Accessibility.ImageAnnotation.ServerRequests
* Accessibility.ImageAnnotation.CacheHits

If we see a significant decrease in the number of
server requests or cache hits, we may need to
revisit this change.

Bug: 389897606

Change-Id: Ife64a1bfd7cd1be06c174a02338ec7e9065a1b6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6191348
Reviewed-by: Mark Schillaci <mschillaci@google.com>
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: David Tseng <dtseng@chromium.org>
Commit-Queue: Lucas Radaelli <lucasradaelli@google.com>
Cr-Commit-Position: refs/heads/main@{#1425794}
This commit is contained in:
Lucas Radaelli
2025-02-27 09:29:11 -08:00
committed by Chromium LUCI CQ
parent e04a4524b7
commit 329749f3fc
5 changed files with 38 additions and 2 deletions

@ -4100,6 +4100,10 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityNestedList) {
RunHtmlTest(FILE_PATH_LITERAL("nestedlist.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilitySmallAlt) {
RunHtmlTest(FILE_PATH_LITERAL("small-alt.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest,
AccessibilityNextAndPreviousOnLineId) {
RunHtmlTest(FILE_PATH_LITERAL("next-and-previous-on-line-id.html"));

@ -607,12 +607,12 @@ bool AXImageAnnotator::ImageNameHasMostlyStopwords(
// Compute how many characters remain after removing stopwords.
int remaining_codepoints = GetLengthAfterRemovingStopwords(image_name);
// If there are 3 or fewer unicode codepoints remaining, classify
// If there are less than 3 unicode codepoints remaining, classify
// the string as "mostly stopwords".
//
// More details and analysis in this (Google-internal) design doc:
// http://goto.google.com/augment-existing-image-descriptions
return (remaining_codepoints <= 3);
return (remaining_codepoints < 3);
}
#if defined(CONTENT_IMPLEMENTATION)

@ -5066,6 +5066,8 @@ data/accessibility/html/simple_spans.html
data/accessibility/html/slot-display-contents-expected-auralinux.txt
data/accessibility/html/slot-display-contents-expected-blink.txt
data/accessibility/html/slot-display-contents.html
data/accessibility/html/small-alt-expected-blink.txt
data/accessibility/html/small-alt.html
data/accessibility/html/small-expected-android-assist-data.txt
data/accessibility/html/small-expected-android-external.txt
data/accessibility/html/small-expected-android.txt

@ -0,0 +1,7 @@
rootWebArea name='Robert Downey Jr.'
++genericContainer ignored
++++genericContainer
++++++image name='Bob' imageAnnotationStatus=ineligibleForAnnotation
++++++staticText name=' '
++++++++inlineTextBox name=' '
++++++image name='Robert' imageAnnotationStatus=ineligibleForAnnotation

@ -0,0 +1,23 @@
<!--
@BLINK-ALLOW:imageAnnotation*
@BLINK_ALLOW:name=*
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Robert Downey Jr.</title>
</head>
<body>
<img
alt="Bob"
src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Robert_Downey_Jr._2014_Comic-Con.jpg/1024px-Robert_Downey_Jr._2014_Comic-Con.jpg">
<img
alt="Robert"
src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Robert_Downey_Jr._2014_Comic-Con.jpg/1024px-Robert_Downey_Jr._2014_Comic-Con.jpg">
</body>
</html>