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

Changeset 284796 in webkit


Ignore:
Timestamp:
Oct 25, 2021, 10:58:01 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

AX: Keyboard-focusable leaf nodes with labels should be accessible elements on iOS
https://bugs.webkit.org/show_bug.cgi?id=232126

Patch by Tyler Wilcock <Tyler Wilcock> on 2021-10-25
Reviewed by Andres Gonzalez.

Source/WebCore:

Consider any focusable leaf node that has a label to be an
accessible element on iOS. See Google Maps JS API usecase
in: https://bugs.webkit.org/show_bug.cgi?id=223492

Test: accessibility/ios-simulator/keyboard-focusable-leaf-nodes.html

  • accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:

(-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
Rather than returning false as a fallback, call an element accessible
if it focusable, has a label, and is a leaf node (has no accessible
children).
(-[WebAccessibilityObjectWrapper accessibilityLabel]):
Don't compute axTitle, axDescription, interactiveDescription, and
interactiveVideoDescription until we actually need them (this is
a refactor unrelated to the patch title).

LayoutTests:

Add test ensuring focusable leaf nodes with labels are accessible elements on iOS.

  • accessibility/ios-simulator/labeled-focusable-leaf-nodes-expected.txt: Added.
  • accessibility/ios-simulator/labeled-focusable-leaf-nodes.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r284795 r284796  
     12021-10-25  Tyler Wilcock  <tyler_w@apple.com>
     2
     3        AX: Keyboard-focusable leaf nodes with labels should be accessible elements on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=232126
     5
     6        Reviewed by Andres Gonzalez.
     7
     8        Add test ensuring focusable leaf nodes with labels are accessible elements on iOS.
     9
     10        * accessibility/ios-simulator/labeled-focusable-leaf-nodes-expected.txt: Added.
     11        * accessibility/ios-simulator/labeled-focusable-leaf-nodes.html: Added.
     12
    1132021-10-25  Eric Hutchison  <ehutchison@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r284793 r284796  
     12021-10-25  Tyler Wilcock  <tyler_w@apple.com>
     2
     3        AX: Keyboard-focusable leaf nodes with labels should be accessible elements on iOS
     4        https://bugs.webkit.org/show_bug.cgi?id=232126
     5
     6        Reviewed by Andres Gonzalez.
     7
     8        Consider any focusable leaf node that has a label to be an
     9        accessible element on iOS. See Google Maps JS API usecase
     10        in: https://bugs.webkit.org/show_bug.cgi?id=223492
     11
     12        Test: accessibility/ios-simulator/keyboard-focusable-leaf-nodes.html
     13
     14        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
     15        (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
     16        Rather than returning false as a fallback, call an element accessible
     17        if it focusable, has a label, and is a leaf node (has no accessible
     18        children).
     19        (-[WebAccessibilityObjectWrapper accessibilityLabel]):
     20        Don't compute `axTitle`, `axDescription`, `interactiveDescription`, and
     21        `interactiveVideoDescription` until we actually need them (this is
     22        a refactor unrelated to the patch title).
     23
    1242021-10-25  Ziran Sun  <zsun@igalia.com>
    225
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r283851 r284796  
    938938            return true;
    939939        FALLTHROUGH;
    940     // All other elements are ignored on the iphone.
    941940    case AccessibilityRole::Annotation:
    942941    case AccessibilityRole::Application:
     
    984983    case AccessibilityRole::GrowArea:
    985984    case AccessibilityRole::HelpTag:
    986     case AccessibilityRole::Ignored:
    987985    case AccessibilityRole::Inline:
    988986    case AccessibilityRole::Insertion:
     
    10101008    case AccessibilityRole::Paragraph:
    10111009    case AccessibilityRole::Pre:
    1012     case AccessibilityRole::Presentational:
    10131010    case AccessibilityRole::RadioGroup:
     1011    case AccessibilityRole::RowGroup:
    10141012    case AccessibilityRole::RowHeader:
    10151013    case AccessibilityRole::Row:
     
    10471045    case AccessibilityRole::TreeGrid:
    10481046    case AccessibilityRole::Toolbar:
    1049     case AccessibilityRole::Unknown:
    10501047    case AccessibilityRole::UserInterfaceTooltip:
    10511048    case AccessibilityRole::WebApplication:
    10521049    case AccessibilityRole::WebArea:
    10531050    case AccessibilityRole::Window:
    1054     case AccessibilityRole::RowGroup:
     1051        // Consider focusable leaf-nodes with a label to be accessible elements.
     1052        // https://bugs.webkit.org/show_bug.cgi?id=223492
     1053        return self.axBackingObject->isKeyboardFocusable()
     1054            && [self accessibilityElementCount] == 0
     1055            && self.axBackingObject->descriptionAttributeValue().stripWhiteSpace().length() > 0;
     1056    case AccessibilityRole::Ignored:
     1057    case AccessibilityRole::Presentational:
     1058    case AccessibilityRole::Unknown:
    10551059        return false;
    10561060    }
     
    11741178
    11751179    auto* backingObject = self.axBackingObject;
    1176 
    1177     // iOS doesn't distinguish between a title and description field,
    1178     // so concatentation will yield the best result.
    1179     NSString *axTitle = backingObject->titleAttributeValue();
    1180     NSString *axDescription = backingObject->descriptionAttributeValue();
    1181     NSString *landmarkDescription = [self ariaLandmarkRoleDescription];
    1182     NSString *interactiveVideoDescription = [self interactiveVideoDescription];
    11831180
    11841181    // If self is static text inside a heading, the label should be the string
     
    12001197        }
    12011198    }
     1199
     1200    // iOS doesn't distinguish between a title and description field,
     1201    // so concatentation will yield the best result.
     1202    NSString *axTitle = backingObject->titleAttributeValue();
     1203    NSString *axDescription = backingObject->descriptionAttributeValue();
     1204    NSString *landmarkDescription = [self ariaLandmarkRoleDescription];
     1205    NSString *interactiveVideoDescription = [self interactiveVideoDescription];
    12021206
    12031207    // We should expose the value of the input type date or time through AXValue instead of AXTitle.
Note: See TracChangeset for help on using the changeset viewer.