Bug 218316 - AX: VoiceOver does not announce the aria-checked state for ARIA treeitem
Summary: AX: VoiceOver does not announce the aria-checked state for ARIA treeitem
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Safari 14
Hardware: All All
: P2 Normal
Assignee: chris fleizach
URL: https://codepen.io/toddlr/pen/PozQELp
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-28 17:28 PDT by Todd Kloots
Modified: 2020-12-01 16:55 PST (History)
11 users (show)

See Also:


Attachments
Screen recording using an ARIA tree with the aria-checked state in Safari with VoiceOver (2.96 MB, video/quicktime)
2020-10-28 17:28 PDT, Todd Kloots
no flags Details
patch (12.64 KB, patch)
2020-11-20 10:40 PST, chris fleizach
no flags Details | Formatted Diff | Diff
patch (20.84 KB, patch)
2020-11-20 22:54 PST, chris fleizach
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
patch (36 bytes, patch)
2020-11-21 11:19 PST, chris fleizach
no flags Details | Formatted Diff | Diff
patch (20.53 KB, patch)
2020-11-30 10:39 PST, chris fleizach
no flags Details | Formatted Diff | Diff
Patch (21.11 KB, patch)
2020-11-30 15:33 PST, chris fleizach
no flags Details | Formatted Diff | Diff
patch (21.01 KB, patch)
2020-11-30 18:35 PST, chris fleizach
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Todd Kloots 2020-10-28 17:28:45 PDT
Created attachment 412593 [details]
Screen recording using an ARIA tree with the aria-checked state in Safari with VoiceOver

What steps will reproduce the problem?
1. Start VoiceOver
2. Goto https://codepen.io/toddlr/pen/PozQELp
3. Move focus to the ARIA tree instance
4. Use the up/down arrow keys to move focus through the ARIA treeitem instances
5. Notice the aria-checked state is not announced
6. Use the spacebar to toggle the aria-checked state
7. Notice the aria-checked state is not announced when the value changes

What is the expected result?
VoiceOver should announce the aria-checked state


What happens instead of that?
VoiceOver does not announce the aria-checked state
Comment 1 Radar WebKit Bug Importer 2020-10-28 17:29:01 PDT
<rdar://problem/70787809>
Comment 2 chris fleizach 2020-11-20 10:38:14 PST
Note that this fix will require a WebKit and a VoiceOver change. The VoiceOver bug will not have visibility on this website
Comment 3 chris fleizach 2020-11-20 10:40:27 PST
Created attachment 414697 [details]
patch
Comment 4 Andres Gonzalez 2020-11-20 10:52:07 PST
(In reply to chris fleizach from comment #3)
> Created attachment 414697 [details]
> patch

Why a Mac only test since seems you are adding it for iOS too?
Comment 5 chris fleizach 2020-11-20 10:52:58 PST
(In reply to Andres Gonzalez from comment #4)
> (In reply to chris fleizach from comment #3)
> > Created attachment 414697 [details]
> > patch
> 
> Why a Mac only test since seems you are adding it for iOS too?

Will add one
Comment 6 Andres Gonzalez 2020-11-20 11:06:45 PST
--- a/Source/WebCore/accessibility/AccessibilityObject.cpp
+++ a/Source/WebCore/accessibility/AccessibilityObject.cpp
@@ -2736,6 +2736,11 @@ bool AccessibilityObject::supportsRowCountChange() const
     }
 }

+bool AccessibilityObject::treeItemSupportsCheckedState() const
+{
+    return roleValue() == AccessibilityRole::TreeItem && hasAttribute(aria_checkedAttr);
+}
+

Shouldn't we add this to the AccessibilityTreeItem::supportsCheckedState instead of adding a new method to the interface?
Comment 7 chris fleizach 2020-11-20 11:12:27 PST
(In reply to Andres Gonzalez from comment #6)
> --- a/Source/WebCore/accessibility/AccessibilityObject.cpp
> +++ a/Source/WebCore/accessibility/AccessibilityObject.cpp
> @@ -2736,6 +2736,11 @@ bool AccessibilityObject::supportsRowCountChange()
> const
>      }
>  }
> 
> +bool AccessibilityObject::treeItemSupportsCheckedState() const
> +{
> +    return roleValue() == AccessibilityRole::TreeItem &&
> hasAttribute(aria_checkedAttr);
> +}
> +
> 
> Shouldn't we add this to the AccessibilityTreeItem::supportsCheckedState
> instead of adding a new method to the interface?

Yes we can do that, I just get nervous about methods only in one class which sometimes causes confusion when we do a bad cast
Comment 8 Andres Gonzalez 2020-11-20 11:20:00 PST
(In reply to chris fleizach from comment #7)
> (In reply to Andres Gonzalez from comment #6)
> > --- a/Source/WebCore/accessibility/AccessibilityObject.cpp
> > +++ a/Source/WebCore/accessibility/AccessibilityObject.cpp
> > @@ -2736,6 +2736,11 @@ bool AccessibilityObject::supportsRowCountChange()
> > const
> >      }
> >  }
> > 
> > +bool AccessibilityObject::treeItemSupportsCheckedState() const
> > +{
> > +    return roleValue() == AccessibilityRole::TreeItem &&
> > hasAttribute(aria_checkedAttr);
> > +}
> > +
> > 
> > Shouldn't we add this to the AccessibilityTreeItem::supportsCheckedState
> > instead of adding a new method to the interface?
> 
> Yes we can do that, I just get nervous about methods only in one class which
> sometimes causes confusion when we do a bad cast

It would be much cleaner. The need of casting AccessibilityObjects to its subclasses is greatly diminished because AXCoreObjects are not just AccessibilityObjects any more, but also AXIsolatedObjects. So as we move clients to using AXCoreObject, they cannot cast any more, which is a good thing.
Comment 9 Andres Gonzalez 2020-11-20 11:21:57 PST
When I said clients above I meant platform code as the client of the core classes.
Comment 10 chris fleizach 2020-11-20 22:54:22 PST
Created attachment 414755 [details]
patch
Comment 11 chris fleizach 2020-11-21 11:19:07 PST
Created attachment 414768 [details]
patch
Comment 12 chris fleizach 2020-11-30 10:39:21 PST
Created attachment 415032 [details]
patch
Comment 13 chris fleizach 2020-11-30 15:33:17 PST
Created attachment 415068 [details]
Patch
Comment 14 Andres Gonzalez 2020-11-30 18:30:37 PST
(In reply to chris fleizach from comment #13)
> Created attachment 415068 [details]
> Patch

Looks good. Just a couple of minor issues.

--- a/LayoutTests/accessibility/ios-simulator/checked-status-tree-items.html
+++ a/LayoutTests/accessibility/ios-simulator/checked-status-tree-items.html

+        var treeItemNotChecked = accessibilityController.accessibleElementById("treeitem_notchecked");

This is not used and it will be null since there is no element with that id attribute.

--- a/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
+++ a/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h

+    bool supportsCheckedState() const override { return boolAttributeValue(AXPropertyName::SupportsCheckedState); };

Extra ; at the end of the line.
Comment 15 chris fleizach 2020-11-30 18:35:20 PST
Created attachment 415089 [details]
patch

Thanks Andres -- addressed.
Comment 16 EWS 2020-12-01 16:55:28 PST
Committed r270333: <https://trac.webkit.org/changeset/270333>

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