Bug 270243 - AX: VoiceOver doesn't speak the value of the meridiem component in time controls.
Summary: AX: VoiceOver doesn't speak the value of the meridiem component in time contr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Andres Gonzalez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-02-28 12:43 PST by Andres Gonzalez
Modified: 2024-03-15 13:22 PDT (History)
14 users (show)

See Also:


Attachments
Patch (1.55 KB, patch)
2024-02-28 12:49 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (1.76 KB, patch)
2024-02-29 08:47 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (3.61 KB, patch)
2024-03-12 18:28 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (3.98 KB, patch)
2024-03-13 07:35 PDT, Andres Gonzalez
tyler_w: commit-queue-
Details | Formatted Diff | Diff
Patch (10.82 KB, patch)
2024-03-13 21:36 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (11.23 KB, patch)
2024-03-13 22:25 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 Andres Gonzalez 2024-02-28 12:43:09 PST
.
Comment 1 Radar WebKit Bug Importer 2024-02-28 12:43:20 PST
<rdar://problem/123781149>
Comment 2 Andres Gonzalez 2024-02-28 12:49:55 PST
Created attachment 470088 [details]
Patch
Comment 3 Andres Gonzalez 2024-02-29 08:47:07 PST
Created attachment 470097 [details]
Patch
Comment 4 Andres Gonzalez 2024-03-12 18:28:28 PDT
Created attachment 470328 [details]
Patch
Comment 5 Tyler Wilcock 2024-03-12 18:46:21 PDT
Comment on attachment 470328 [details]
Patch

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

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:423
> +        if (element->isInUserAgentShadowTree() && element->userAgentPart() == UserAgentParts::webkitDatetimeEditMeridiemField()) {
> +            // The meridiem field of a datetime control is currently exposed as a button in order for VO to announce its value correctly.
> +            // It cannot be a SpinButton like other datetime fields because it is not numeric, i.e., its values are textual.
> +            // FIXME: This should be changed to a meaningful role that better reflects the nature of this UI component, i.e., a spin button with textual values that can be set with up/down arrows or first character.
> +            return AccessibilityRole::Button;
> +        }

Would it work to call element->setAttribute("role", "button") in `DateTimeMeridiemFieldElement::create`? That way we wouldn't pay the cost for doing this check for every div on the page.

> Source/WebCore/html/shadow/DateTimeFieldElements.cpp:-149
> -    element->setAttributeWithoutSynchronization(HTMLNames::aria_labelAttr, AtomString { AXTimeFieldMeridiemText() });

Is AXTimeFieldMeridiemText() unused after this patch?
Comment 6 Andres Gonzalez 2024-03-13 07:35:20 PDT
Created attachment 470341 [details]
Patch
Comment 7 Andres Gonzalez 2024-03-13 07:43:36 PDT
(In reply to Tyler Wilcock from comment #5)
> Comment on attachment 470328 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=470328&action=review
> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:423
> > +        if (element->isInUserAgentShadowTree() && element->userAgentPart() == UserAgentParts::webkitDatetimeEditMeridiemField()) {
> > +            // The meridiem field of a datetime control is currently exposed as a button in order for VO to announce its value correctly.
> > +            // It cannot be a SpinButton like other datetime fields because it is not numeric, i.e., its values are textual.
> > +            // FIXME: This should be changed to a meaningful role that better reflects the nature of this UI component, i.e., a spin button with textual values that can be set with up/down arrows or first character.
> > +            return AccessibilityRole::Button;
> > +        }
> 
> Would it work to call element->setAttribute("role", "button") in
> `DateTimeMeridiemFieldElement::create`? That way we wouldn't pay the cost
> for doing this check for every div on the page.

I went back and forth between these two changes, and the main reason to go this way was not to be dependent on ARIA roles. Nevertheless, since this is a temporary fix in my view, I went back to specifying the role via the HTML role attribute in the last revision.

> 
> > Source/WebCore/html/shadow/DateTimeFieldElements.cpp:-149
> > -    element->setAttributeWithoutSynchronization(HTMLNames::aria_labelAttr, AtomString { AXTimeFieldMeridiemText() });
> 
> Is AXTimeFieldMeridiemText() unused after this patch?

Fixed. We should do a deeper cleanup of these cause I think there is plenty of unused ones.
Comment 8 Tyler Wilcock 2024-03-13 15:33:15 PDT
Comment on attachment 470341 [details]
Patch

Sorry, I didn't r+ this, was hoping to discuss more. I still don't understand why this div needs any role for the text within to be readable by VoiceOver. Also, won't VoiceOver read this as a button now, which might be confusing since I assume it doesn't actually act like a button?
Comment 9 Andres Gonzalez 2024-03-13 16:17:57 PDT
(In reply to Tyler Wilcock from comment #8)
> Comment on attachment 470341 [details]
> Patch
> 
> Sorry, I didn't r+ this, was hoping to discuss more. I still don't
> understand why this div needs any role for the text within to be readable by
> VoiceOver. Also, won't VoiceOver read this as a button now, which might be
> confusing since I assume it doesn't actually act like a button?

If we don't set a role, VO will announce it as a group. Button is the best tradeoff with existing roles. We will need to add a new role or extend spin button to handle non-numeric values. I don't think that is in the scope of this change, we should do that as a separate patch.
Comment 10 Tyler Wilcock 2024-03-13 21:36:25 PDT
Created attachment 470360 [details]
Patch
Comment 11 Tyler Wilcock 2024-03-13 22:25:20 PDT
Created attachment 470361 [details]
Patch
Comment 12 EWS 2024-03-15 13:22:21 PDT
Committed 276195@main (bc6637d9eddb): <https://commits.webkit.org/276195@main>

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