Bug 222375 - WebAccessibilityObjectWrapper method to retrieve related error message elements should return not-ignored accessibility elements.
Summary: WebAccessibilityObjectWrapper method to retrieve related error message elemen...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andres Gonzalez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-24 12:02 PST by Andres Gonzalez
Modified: 2021-03-01 13:11 PST (History)
9 users (show)

See Also:


Attachments
Patch (17.58 KB, patch)
2021-02-24 12:20 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (15.83 KB, patch)
2021-02-26 12:38 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (15.80 KB, patch)
2021-02-26 12:52 PST, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (15.85 KB, patch)
2021-03-01 11:58 PST, Andres Gonzalez
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 2021-02-24 12:02:02 PST
WebAccessibilityObjectWrapper method to retrieve related error message elements should return not-ignored accessibility elements.
Comment 1 Andres Gonzalez 2021-02-24 12:20:08 PST
Created attachment 421439 [details]
Patch
Comment 2 chris fleizach 2021-02-24 12:50:55 PST
Comment on attachment 421439 [details]
Patch

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

> Source/WebCore/accessibility/AccessibilityObjectInterface.h:1578
> +        if (child)

pretty sure child should always be non nil here right?

> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1878
> +        ASSERT(element);

shouldn't we always have an element from the vector?

> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2913
> +        for (const auto& element : errorElements) {

do we need to do this for Mac? I think they have code to handle descendant output correctly
Comment 3 Andres Gonzalez 2021-02-24 14:20:18 PST
(In reply to chris fleizach from comment #2)
> Comment on attachment 421439 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=421439&action=review
> 
> > Source/WebCore/accessibility/AccessibilityObjectInterface.h:1578
> > +        if (child)
> 
> pretty sure child should always be non nil here right?

Hard to say because several classes override updateChildrenIfNecessary() and m_children is a Vector<RefPtr>. If we want to enforce that children()[i] is not null, we should probably change m_children to be Vector<Ref>.

> 
> > Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1878
> > +        ASSERT(element);
> 
> shouldn't we always have an element from the vector?

The value is a RefPtr, which should be not null, thus the ASSERT.
> 
> > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2913
> > +        for (const auto& element : errorElements) {
> 
> do we need to do this for Mac? I think they have code to handle descendant
> output correctly

Probably, but thought it wouldn't hurt to return elements that are actually not ignored. And keeps some consistency between Mac and iOS implementations. We can revisit when Mac clients implement this support.
Comment 4 chris fleizach 2021-02-24 14:27:08 PST
Comment on attachment 421439 [details]
Patch

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

>>> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1878
>>> +        ASSERT(element);
>> 
>> shouldn't we always have an element from the vector?
> 
> The value is a RefPtr, which should be not null, thus the ASSERT.

I feel like we probably don't need to worry about this. are we doing this anywhere else we access elements?

>>> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2913
>>> +        for (const auto& element : errorElements) {
>> 
>> do we need to do this for Mac? I think they have code to handle descendant output correctly
> 
> Probably, but thought it wouldn't hurt to return elements that are actually not ignored. And keeps some consistency between Mac and iOS implementations. We can revisit when Mac clients implement this support.

I'm actually worried that VO may do the wrong thing in this case because its different from other examples. Does this already work on MacOS or do they need to implement this attribute?
Comment 5 Andres Gonzalez 2021-02-24 15:09:37 PST
(In reply to chris fleizach from comment #4)
> Comment on attachment 421439 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=421439&action=review
> 
> >>> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:1878
> >>> +        ASSERT(element);
> >> 
> >> shouldn't we always have an element from the vector?
> > 
> > The value is a RefPtr, which should be not null, thus the ASSERT.
> 
> I feel like we probably don't need to worry about this. are we doing this
> anywhere else we access elements?

I think we do a fair amount of AXObject* null checks, when passing parameters around, indirectly when using is<classname>, etc. It is just better to ensure you don't dereference a null pointer. In this case is just an assert to ensure that the method errorMessageElements() doesn't rotten.
> 
> >>> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2913
> >>> +        for (const auto& element : errorElements) {
> >> 
> >> do we need to do this for Mac? I think they have code to handle descendant output correctly
> > 
> > Probably, but thought it wouldn't hurt to return elements that are actually not ignored. And keeps some consistency between Mac and iOS implementations. We can revisit when Mac clients implement this support.
> 
> I'm actually worried that VO may do the wrong thing in this case because its
> different from other examples. Does this already work on MacOS or do they
> need to implement this attribute?

It doesn't work with VO on the Mac, and the AXErrorMessageElements is not supported yet.
Comment 6 chris fleizach 2021-02-24 15:22:10 PST
Comment on attachment 421439 [details]
Patch

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

>>>>> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2913
>>>>> +        for (const auto& element : errorElements) {
>>>> 
>>>> do we need to do this for Mac? I think they have code to handle descendant output correctly
>>> 
>>> Probably, but thought it wouldn't hurt to return elements that are actually not ignored. And keeps some consistency between Mac and iOS implementations. We can revisit when Mac clients implement this support.
>> 
>> I'm actually worried that VO may do the wrong thing in this case because its different from other examples. Does this already work on MacOS or do they need to implement this attribute?
> 
> It doesn't work with VO on the Mac, and the AXErrorMessageElements is not supported yet.

ok, I think it should be a bit more like the other Mac methods that return the referenced element, rather than diving down into the group.
Comment 7 Andres Gonzalez 2021-02-26 12:38:02 PST
Created attachment 421698 [details]
Patch
Comment 8 chris fleizach 2021-02-26 12:40:47 PST
Comment on attachment 421698 [details]
Patch

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

> Source/WebCore/accessibility/AccessibilityObjectInterface.h:1578
> +        if (child)

I know we had this conversation before, but I just don't think we ever have the array of children returning us nil elements. so I don't think this check is necessary
Comment 9 Andres Gonzalez 2021-02-26 12:43:26 PST
(In reply to chris fleizach from comment #6)
> Comment on attachment 421439 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=421439&action=review
> 
> >>>>> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2913
> >>>>> +        for (const auto& element : errorElements) {
> >>>> 
> >>>> do we need to do this for Mac? I think they have code to handle descendant output correctly
> >>> 
> >>> Probably, but thought it wouldn't hurt to return elements that are actually not ignored. And keeps some consistency between Mac and iOS implementations. We can revisit when Mac clients implement this support.
> >> 
> >> I'm actually worried that VO may do the wrong thing in this case because its different from other examples. Does this already work on MacOS or do they need to implement this attribute?
> > 
> > It doesn't work with VO on the Mac, and the AXErrorMessageElements is not supported yet.
> 
> ok, I think it should be a bit more like the other Mac methods that return
> the referenced element, rather than diving down into the group.

Reverted the change for Mac, we dive into the group only for iOS.
Comment 10 Andres Gonzalez 2021-02-26 12:52:51 PST
Created attachment 421700 [details]
Patch
Comment 11 Andres Gonzalez 2021-02-26 12:54:19 PST
(In reply to chris fleizach from comment #8)
> Comment on attachment 421698 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=421698&action=review
> 
> > Source/WebCore/accessibility/AccessibilityObjectInterface.h:1578
> > +        if (child)
> 
> I know we had this conversation before, but I just don't think we ever have
> the array of children returning us nil elements. so I don't think this check
> is necessary

Ok, removed null check.
Comment 12 EWS 2021-02-26 13:34:08 PST
commit-queue failed to commit attachment 421700 [details] to WebKit repository. To retry, please set cq+ flag again.
Comment 13 Andres Gonzalez 2021-03-01 11:58:14 PST
Created attachment 421853 [details]
Patch
Comment 14 EWS 2021-03-01 13:09:52 PST
Committed r273684: <https://commits.webkit.org/r273684>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 421853 [details].
Comment 15 Radar WebKit Bug Importer 2021-03-01 13:11:51 PST
<rdar://problem/74886782>