Changeset 221918 in webkit


Ignore:
Timestamp:
Sep 12, 2017 9:31:41 AM (7 years ago)
Author:
Chris Fleizach
Message:

AX: On generic container elements, WebKit should distinguish between tooltip (e.g. @title) and label (e.g. @aria-label) attributes
https://bugs.webkit.org/show_bug.cgi?id=170475
<rdar://problem/31439222>

Reviewed by Joanmarie Diggs.

Source/WebCore:

Test: accessibility/title-tag-on-unimportant-elements-is-help-text.html

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::helpText):
(WebCore::AccessibilityNodeObject::accessibilityDescription):
(WebCore::AccessibilityNodeObject::roleIgnoresTitle):

  • accessibility/AccessibilityNodeObject.h:

LayoutTests:

  • accessibility/title-tag-on-unimportant-elements-is-help-text-expected.txt: Added.
  • accessibility/title-tag-on-unimportant-elements-is-help-text.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r221915 r221918  
     12017-09-12  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: On generic container elements, WebKit should distinguish between tooltip (e.g. @title) and label (e.g. @aria-label) attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=170475
     5        <rdar://problem/31439222>
     6
     7        Reviewed by Joanmarie Diggs.
     8
     9        * accessibility/title-tag-on-unimportant-elements-is-help-text-expected.txt: Added.
     10        * accessibility/title-tag-on-unimportant-elements-is-help-text.html: Added.
     11
    1122017-09-12  Ms2ger  <Ms2ger@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r221917 r221918  
     12017-09-12  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: On generic container elements, WebKit should distinguish between tooltip (e.g. @title) and label (e.g. @aria-label) attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=170475
     5        <rdar://problem/31439222>
     6
     7        Reviewed by Joanmarie Diggs.
     8
     9        Test: accessibility/title-tag-on-unimportant-elements-is-help-text.html
     10
     11        * accessibility/AccessibilityNodeObject.cpp:
     12        (WebCore::AccessibilityNodeObject::helpText):
     13        (WebCore::AccessibilityNodeObject::accessibilityDescription):
     14        (WebCore::AccessibilityNodeObject::roleIgnoresTitle):
     15        * accessibility/AccessibilityNodeObject.h:
     16
    1172017-09-12  Brent Fulgham  <bfulgham@apple.com>
    218
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r219661 r221918  
    14531453    const AtomicString& title = getAttribute(titleAttr);
    14541454    if (!title.isEmpty()) {
    1455         if (!isMeter())
     1455        if (!isMeter() && !roleIgnoresTitle())
    14561456            textOrder.append(AccessibilityText(title, TitleTagText));
    14571457        else
     
    15581558    // If this point is reached (i.e. there's no accessibilityDescription) and there's no title(), we should fallback to using the title attribute.
    15591559    // The title attribute is normally used as help text (because it is a tooltip), but if there is nothing else available, this should be used (according to ARIA).
    1560     if (title().isEmpty())
     1560    // https://bugs.webkit.org/show_bug.cgi?id=170475: An exception is when the element is semantically unimportant. In those cases, title text should remain as help text.
     1561    if (title().isEmpty() && !roleIgnoresTitle())
    15611562        return getAttribute(titleAttr);
    15621563
    15631564    return String();
     1565}
     1566
     1567// Returns whether the role was not intended to play a semantically meaningful part of the
     1568// accessibility hierarchy. This applies to generic groups like <div>'s with no role value set.
     1569bool AccessibilityNodeObject::roleIgnoresTitle() const
     1570{
     1571    if (ariaRoleAttribute() != UnknownRole)
     1572        return false;
     1573
     1574    switch (roleValue()) {
     1575    case DivRole:
     1576    case UnknownRole:
     1577        return true;
     1578    default:
     1579        return false;
     1580    }
    15641581}
    15651582
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h

    r219075 r221918  
    190190    bool computeAccessibilityIsIgnored() const override;
    191191    bool usesAltTagForTextComputation() const;
    192 
     192    bool roleIgnoresTitle() const;
     193   
    193194    Node* m_node;
    194195};
Note: See TracChangeset for help on using the changeset viewer.