⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284844 in webkit


Ignore:
Timestamp:
Oct 25, 2021, 4:20:28 PM (5 years ago)
Author:
Chris Fleizach
Message:

WebKit should use img@title as label even if img@alt is exlicitly empty
https://bugs.webkit.org/show_bug.cgi?id=173870
<rdar://problem/33010427>

Reviewed by Andres Gonzalez.

Source/WebCore:

alt="" usually means to ignore an image. However, when it also carries other
descriptive attributes, that is probably the wrong decision.
Other browsers are not ignoring these images, WebKit should follow suit.

This issue has been raised with
https://github.com/w3c/accname/issues/27

Test: accessibility/img-no-alt-not-ignored-with-title.html

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):

LayoutTests:

  • accessibility/img-no-alt-not-ignored-with-title-expected.txt: Added.
  • accessibility/img-no-alt-not-ignored-with-title.html: Added.
  • platform/ios-simulator/TestExpectations:
  • platform/win/TestExpectations:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r284842 r284844  
     12021-10-25  Chris Fleizach  <cfleizach@apple.com>
     2
     3        WebKit should use img@title as label even if img@alt is exlicitly empty
     4        https://bugs.webkit.org/show_bug.cgi?id=173870
     5        <rdar://problem/33010427>
     6
     7        Reviewed by Andres Gonzalez.
     8
     9        * accessibility/img-no-alt-not-ignored-with-title-expected.txt: Added.
     10        * accessibility/img-no-alt-not-ignored-with-title.html: Added.
     11        * platform/ios-simulator/TestExpectations:
     12        * platform/win/TestExpectations:
     13
    1142021-10-25  Eric Hutchison  <ehutchison@apple.com>
    215
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r284752 r284844  
    44#
    55
     6accessibility/img-no-alt-not-ignored-with-title.html [ Pass ]
    67accessibility/insert-newline.html [ Pass ]
    78accessibility/url-test.html [ Pass ]
  • trunk/LayoutTests/platform/win/TestExpectations

    r284731 r284844  
    275275accessibility/listbox-clear-selection.html [ Skip ]
    276276accessibility/embedded-image-description.html [ Skip ]
     277accessibility/img-no-alt-not-ignored-with-title.html [ Skip ]
    277278
    278279# TODO Conic gradients
  • trunk/Source/WebCore/ChangeLog

    r284822 r284844  
     12021-10-25  Chris Fleizach  <cfleizach@apple.com>
     2
     3        WebKit should use img@title as label even if img@alt is exlicitly empty
     4        https://bugs.webkit.org/show_bug.cgi?id=173870
     5        <rdar://problem/33010427>
     6
     7        Reviewed by Andres Gonzalez.
     8
     9        alt="" usually means to ignore an image. However, when it also carries other
     10        descriptive attributes, that is probably the wrong decision.
     11        Other browsers are not ignoring these images, WebKit should follow suit.
     12       
     13        This issue has been raised with
     14        https://github.com/w3c/accname/issues/27
     15
     16        Test: accessibility/img-no-alt-not-ignored-with-title.html
     17
     18        * accessibility/AccessibilityRenderObject.cpp:
     19        (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
     20
    1212021-10-25  Ayumi Kojima  <ayumi_kojima@apple.com>
    222
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r284769 r284844  
    14441444            return false;
    14451445
     1446        // webkit.org/b/173870 - If an image has other alternative text, don't ignore it if alt text is empty.
     1447        // This means we should process title and aria-label first.
     1448       
     1449        // If an image has the title or label attributes, accessibility should be lenient and allow it to appear in the hierarchy (according to WAI-ARIA).
     1450        if (!getAttribute(titleAttr).isEmpty() || !getAttribute(aria_labelAttr).isEmpty())
     1451            return false;
     1452
    14461453        // First check the RenderImage's altText (which can be set through a style sheet, or come from the Element).
    14471454        // However, if this is not a native image, fallback to the attribute on the Element.
     
    14561463            return true;
    14571464        if (altTextInclusion == AccessibilityObjectInclusion::IncludeObject)
    1458             return false;
    1459 
    1460         // If an image has the title or label attributes, accessibility should be lenient and allow it to appear in the hierarchy (according to WAI-ARIA).
    1461         if (!getAttribute(titleAttr).isEmpty() || !getAttribute(aria_labelAttr).isEmpty())
    14621465            return false;
    14631466
Note: See TracChangeset for help on using the changeset viewer.