Bug 272852 - AX: Whitespace-only aria-labels should not be respected in accname calculation
Summary: AX: Whitespace-only aria-labels should not be respected in accname calculation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-04-17 14:11 PDT by Tyler Wilcock
Modified: 2024-04-20 08:10 PDT (History)
13 users (show)

See Also:


Attachments
Patch (20.26 KB, patch)
2024-04-17 14:26 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (20.26 KB, patch)
2024-04-18 08:05 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (20.05 KB, patch)
2024-04-18 15:58 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (20.05 KB, patch)
2024-04-19 19:05 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler Wilcock 2024-04-17 14:11:07 PDT
https://w3c.github.io/accname/#comp_label

> AriaLabel: Otherwise, if the current node has an aria-label attribute whose value is not undefined, not the empty string, nor, when trimmed of whitespace, is not the empty string:
>  1. If traversal of the current node is due to recursion and the current node is an embedded control, ignore aria-label and skip to rule Embedded Control.
>  2. Otherwise, return the value of aria-label.
Comment 1 Radar WebKit Bug Importer 2024-04-17 14:11:18 PDT
<rdar://problem/126643869>
Comment 2 Tyler Wilcock 2024-04-17 14:26:28 PDT
Created attachment 470970 [details]
Patch
Comment 3 chris fleizach 2024-04-17 23:47:13 PDT
Comment on attachment 470970 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=470970&action=review

> Source/WebCore/accessibility/AccessibilityObject.h:544
> +    bool hasValidAriaLabel() const { return !getAttributeTrimmed(HTMLNames::aria_labelAttr).isEmpty(); }

Feel like we usually say "hasValidARIALabel". 
are we doing Aria in other places? I'm not a fan of that because ARIA is an acronym, not a name

> Source/WebCore/accessibility/AccessibilitySlider.cpp:-110
> -    if (auto* input = inputElement())

we handle this inputElement() thing in the single get attribute method?
Comment 4 Tyler Wilcock 2024-04-18 08:05:46 PDT
Created attachment 470986 [details]
Patch
Comment 5 Tyler Wilcock 2024-04-18 08:18:35 PDT
(In reply to chris fleizach from comment #3)
> Comment on attachment 470970 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=470970&action=review
> 
> > Source/WebCore/accessibility/AccessibilityObject.h:544
> > +    bool hasValidAriaLabel() const { return !getAttributeTrimmed(HTMLNames::aria_labelAttr).isEmpty(); }
> 
> Feel like we usually say "hasValidARIALabel". 
> are we doing Aria in other places? I'm not a fan of that because ARIA is an
> acronym, not a name
We do use "Aria" in other places, e.g. determineAriaRoleAttribute, isPresentationalChildOfAriaRole, handleAriaExpandedChange, isNodeAriaVisible, remapAriaRoleDueToParent, and more.

But I think your point makes sense. I've switched it to hasValidARIALabel (but happy to change it back, I don't feel strongly either way).

> > Source/WebCore/accessibility/AccessibilitySlider.cpp:-110
> > -    if (auto* input = inputElement())
> 
> we handle this inputElement() thing in the single get attribute method?
Yeah, AccessibilitySlider was the only one who overrode getAttribute, and it did so needlessly. The default AccessibilityObject implementation has the same behavior — cast the underlying m_node to an element and get the attribute off of it. This function is called a lot, so de-virtualizing it is nice.
Comment 6 Tyler Wilcock 2024-04-18 15:58:17 PDT
Created attachment 470994 [details]
Patch
Comment 7 Tyler Wilcock 2024-04-19 19:05:00 PDT
Created attachment 471019 [details]
Patch
Comment 8 EWS 2024-04-20 08:10:02 PDT
Committed 277781@main (04d118a7c6f4): <https://commits.webkit.org/277781@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 471019 [details].