Bug 124381 - AX: Improve ARIA live region reliability by sending notifications when live regions are created/shown and hidden/destroyed
Summary: AX: Improve ARIA live region reliability by sending notifications when live r...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Normal
Assignee: chris fleizach
URL:
Keywords: InRadar
: 62289 118541 132662 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-14 14:46 PST by James Craig
Modified: 2014-05-28 13:05 PDT (History)
10 users (show)

See Also:


Attachments
test case demonstrating bugs (1.98 KB, text/html)
2013-11-14 14:46 PST, James Craig
no flags Details
patch (17.29 KB, patch)
2014-04-01 17:35 PDT, chris fleizach
no flags Details | Formatted Diff | Diff
patch (17.29 KB, patch)
2014-04-01 17:43 PDT, chris fleizach
mario: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Craig 2013-11-14 14:46:39 PST
Created attachment 216983 [details]
test case demonstrating bugs

AX: Improve ARIA live region reliability by sending notifications when live regions are created/shown and hidden/destroyed
Comment 1 James Craig 2013-11-14 14:46:51 PST
<rdar://problem/15124143>
Comment 2 James Craig 2013-11-18 15:33:17 PST
*** Bug 62289 has been marked as a duplicate of this bug. ***
Comment 3 James Craig 2014-03-05 20:14:39 PST
*** Bug 118541 has been marked as a duplicate of this bug. ***
Comment 4 chris fleizach 2014-04-01 17:35:00 PDT
Created attachment 228345 [details]
patch
Comment 5 chris fleizach 2014-04-01 17:43:35 PDT
Created attachment 228348 [details]
patch
Comment 6 Mario Sanchez Prada 2014-04-02 04:03:27 PDT
Comment on attachment 228348 [details]
patch

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

> Source/WebCore/accessibility/AccessibilityObject.cpp:1486
> +const String AccessibilityObject::defaultLiveRegionStatusForRole(AccessibilityRole role)

Wouldn't it be better to return a reference to a statically stored AtomicString ("const AtomicString&" return type)?

> Source/WebCore/accessibility/AccessibilityObject.cpp:1840
> +    return equalIgnoringCase(liveRegionStatus, "polite") || equalIgnoringCase(liveRegionStatus, "assertive");

You could check instead for !liveRegionStatus.isNull() && !equalIgnoringCase(liveRegionStatus, "off", although the end result would be the same of course (http://www.w3.org/TR/wai-aria/states_and_properties#aria-live). Just commenting it because in my mind sounds better to exclude the negatives than include all the positive, but I'd rather leave it up to you :)

> Source/WebCore/accessibility/AccessibilityObject.h:839
> -    virtual const AtomicString& ariaLiveRegionStatus() const { return nullAtom; }
> +    virtual const String ariaLiveRegionStatus() const { return String(); }

Following the same reasoning than in my previous comment: is there any specific reason why you're changing the return type from AtomicString& to String? By checking the new code I still get the feeling that returning a reference to a statically stored AtomicString would still be a good idea

> LayoutTests/platform/mac/accessibility/live-region-creation-notification.html:38
> +    window.setTimeout(function() { appendLiveRegion('third'); }, t*1);
> +    
> +    // add fourth live region (hidden), then show later
> +    window.setTimeout(function() { appendLiveRegion('fourth', HIDE); }, t*2);
> +    window.setTimeout(function() { unhide('fourth'); }, t*3);
> +    window.setTimeout(function() { appendDiv('fifth'); }, t*4);
> +    
> +    // update them sequentially after all have been loaded
> +    window.setTimeout(updateAll, t*5);

I'm a bit concerned about chaining the executions of this functions using timeouts (and so small ones), in terms of whether this could cause some flakiness.

Will it be possible to chaining them using a continuation passing style pattern, instead of the timeouts?

> LayoutTests/platform/mac/accessibility/live-region-creation-notification.html:51
> +    window.setTimeout(function() { updateLiveRegion('first'); }, t*1);
> +    window.setTimeout(function() { updateLiveRegion('second'); }, t*2);
> +    window.setTimeout(function() { updateLiveRegion('third'); }, t*3);
> +    window.setTimeout(function() { updateLiveRegion('fourth'); }, t*4);
> +    window.setTimeout(function() { endTest(); }, t*5);

Same comment here: if possible, I'd say that using CPS here would be safer
Comment 7 chris fleizach 2014-04-02 09:18:08 PDT
(In reply to comment #6)
> (From update of attachment 228348 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=228348&action=review
> 
> > Source/WebCore/accessibility/AccessibilityObject.cpp:1486
> > +const String AccessibilityObject::defaultLiveRegionStatusForRole(AccessibilityRole role)
> 
> Wouldn't it be better to return a reference to a statically stored AtomicString ("const AtomicString&" return type)?

I removed the static strings in ariaLiveRegionStatus (for off, assertive, polite) because of the desire made by others in WebKit that we don't use NeverDestroyed strings in areas where performance is not super critical. By removing that I no longer had a reference I could pass back (instead I was used ASCIILiteral), so a few of these methods had to change to String() as a result.

I think that's the direction that people want these static strings to go in, so it seemed to make sense to me to change it here.

> 
> > Source/WebCore/accessibility/AccessibilityObject.cpp:1840
> > +    return equalIgnoringCase(liveRegionStatus, "polite") || equalIgnoringCase(liveRegionStatus, "assertive");
> 
> You could check instead for !liveRegionStatus.isNull() && !equalIgnoringCase(liveRegionStatus, "off", although the end result would be the same of course (http://www.w3.org/TR/wai-aria/states_and_properties#aria-live). Just commenting it because in my mind sounds better to exclude the negatives than include all the positive, but I'd rather leave it up to you :)

I think it might be better to check for positives here because if you set your aria-live="blah" we don't want that to register as a live region enabled.

> 
> > Source/WebCore/accessibility/AccessibilityObject.h:839
> > -    virtual const AtomicString& ariaLiveRegionStatus() const { return nullAtom; }
> > +    virtual const String ariaLiveRegionStatus() const { return String(); }
> 
> Following the same reasoning than in my previous comment: is there any specific reason why you're changing the return type from AtomicString& to String? By checking the new code I still get the feeling that returning a reference to a statically stored AtomicString would still be a good idea
> 
> > LayoutTests/platform/mac/accessibility/live-region-creation-notification.html:38
> > +    window.setTimeout(function() { appendLiveRegion('third'); }, t*1);
> > +    
> > +    // add fourth live region (hidden), then show later
> > +    window.setTimeout(function() { appendLiveRegion('fourth', HIDE); }, t*2);
> > +    window.setTimeout(function() { unhide('fourth'); }, t*3);
> > +    window.setTimeout(function() { appendDiv('fifth'); }, t*4);
> > +    
> > +    // update them sequentially after all have been loaded
> > +    window.setTimeout(updateAll, t*5);
> 
> I'm a bit concerned about chaining the executions of this functions using timeouts (and so small ones), in terms of whether this could cause some flakiness.
> 
> Will it be possible to chaining them using a continuation passing style pattern, instead of the timeouts?
> 
> > LayoutTests/platform/mac/accessibility/live-region-creation-notification.html:51
> > +    window.setTimeout(function() { updateLiveRegion('first'); }, t*1);
> > +    window.setTimeout(function() { updateLiveRegion('second'); }, t*2);
> > +    window.setTimeout(function() { updateLiveRegion('third'); }, t*3);
> > +    window.setTimeout(function() { updateLiveRegion('fourth'); }, t*4);
> > +    window.setTimeout(function() { endTest(); }, t*5);
> 
> Same comment here: if possible, I'd say that using CPS here would be safer

Will do
Comment 8 Mario Sanchez Prada 2014-04-02 09:26:03 PDT
Comment on attachment 228348 [details]
patch

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

Setting r+ after your comments, but please consider the comments

>>> Source/WebCore/accessibility/AccessibilityObject.cpp:1486
>>> +const String AccessibilityObject::defaultLiveRegionStatusForRole(AccessibilityRole role)
>> 
>> Wouldn't it be better to return a reference to a statically stored AtomicString ("const AtomicString&" return type)?
> 
> I removed the static strings in ariaLiveRegionStatus (for off, assertive, polite) because of the desire made by others in WebKit that we don't use NeverDestroyed strings in areas where performance is not super critical. By removing that I no longer had a reference I could pass back (instead I was used ASCIILiteral), so a few of these methods had to change to String() as a result.
> 
> I think that's the direction that people want these static strings to go in, so it seemed to make sense to me to change it here.

Fair enough :)

>>> Source/WebCore/accessibility/AccessibilityObject.cpp:1840
>>> +    return equalIgnoringCase(liveRegionStatus, "polite") || equalIgnoringCase(liveRegionStatus, "assertive");
>> 
>> You could check instead for !liveRegionStatus.isNull() && !equalIgnoringCase(liveRegionStatus, "off", although the end result would be the same of course (http://www.w3.org/TR/wai-aria/states_and_properties#aria-live). Just commenting it because in my mind sounds better to exclude the negatives than include all the positive, but I'd rather leave it up to you :)
> 
> I think it might be better to check for positives here because if you set your aria-live="blah" we don't want that to register as a live region enabled.

Fair enough too
Comment 9 chris fleizach 2014-04-02 09:35:57 PDT
http://trac.webkit.org/changeset/166649

Made the changes for the layout test. Thanks Mario
Comment 10 David Kilzer (:ddkilzer) 2014-04-02 15:30:34 PDT
(In reply to comment #9)
> http://trac.webkit.org/changeset/166649
> 
> Made the changes for the layout test. Thanks Mario

I think test results may be missing for LayoutTests/platform/mac/accessibility/live-region-creation-notification.html.
Comment 11 chris fleizach 2014-04-02 15:33:29 PDT
Checked in
http://trac.webkit.org/changeset/166671
Comment 12 Mario Sanchez Prada 2014-04-03 02:24:31 PDT
(In reply to comment #9)
> http://trac.webkit.org/changeset/166649
> 
> Made the changes for the layout test. Thanks Mario

No problem, and sorry for the noisy review :)
Comment 13 James Craig 2014-05-28 13:05:22 PDT
*** Bug 132662 has been marked as a duplicate of this bug. ***