Bug 32571 - Support the aria-checked attribute
Summary: Support the aria-checked attribute
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows Vista
: P2 Minor
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-15 12:50 PST by Dominic Mazzoni
Modified: 2010-01-05 11:00 PST (History)
6 users (show)

See Also:


Attachments
Patch to add support for the aria-checked attribute. (1.57 KB, patch)
2009-12-15 13:02 PST, Dominic Mazzoni
darin: review-
Details | Formatted Diff | Diff
Improved patch, adds an isChecked method to AccessibilityUIElement (8.33 KB, patch)
2009-12-16 15:02 PST, Dominic Mazzoni
no flags Details | Formatted Diff | Diff
All tests pass; source synced. (9.64 KB, patch)
2009-12-17 14:53 PST, Dominic Mazzoni
no flags Details | Formatted Diff | Diff
Re-synced and updated patch (9.59 KB, patch)
2009-12-18 08:59 PST, Dominic Mazzoni
mjs: review-
Details | Formatted Diff | Diff
Makes native checkedness take precedence when checking for aria-checked. Now tests all permutations of checked and aria-checked. (10.60 KB, patch)
2010-01-04 17:13 PST, Dominic Mazzoni
darin: review+
Details | Formatted Diff | Diff
Address review comments (10.57 KB, patch)
2010-01-04 17:40 PST, Dominic Mazzoni
darin: review+
Details | Formatted Diff | Diff
Easier than I thought. Made both intValue and isChecked const. (11.65 KB, patch)
2010-01-04 18:09 PST, Dominic Mazzoni
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dominic Mazzoni 2009-12-15 12:50:09 PST
For an object with an aria role of "checkbox" or "radiobutton", the aria-checked attribute should be used to determine the state of the object.  (Currently that attribute is being used to return the value, but not the state.  The state is needed for MSAA on Windows.)

I've got a patch that I intend to attach shortly.
Comment 1 Dominic Mazzoni 2009-12-15 13:02:58 PST
Created attachment 44902 [details]
Patch to add support for the aria-checked attribute.
Comment 2 Darin Adler 2009-12-15 14:00:52 PST
Comment on attachment 44902 [details]
Patch to add support for the aria-checked attribute.

We need a regression test for this. We don't take code changes without regression tests. There are lots of accessibility regression tests, although I don't know if they are yet working on the Chrome platform.
Comment 3 Darin Adler 2009-12-15 14:01:56 PST
Thanks for tackling this. I think this is probably good fix for all platforms, not just MSAA on Windows.
Comment 4 chris fleizach 2009-12-15 14:07:35 PST
yea, we'd want this for all platforms, although Mac does not rely on isChecked for checkbox state (it uses intValue() instead)
Comment 5 Eric Seidel (no email) 2009-12-15 14:13:49 PST
Also:
- All changes require a test if possible (which in this case it should be).
- Please don't change the "Reviewed by NOBODY(OOPS!)." line, otherwise our scripts will have trouble updating the reviewer when landing this for you.

Otherwise a patch which works for all platforms would be awesome!
Comment 6 Dominic Mazzoni 2009-12-15 14:30:52 PST
Thanks for the quick feedback, I will be happy to add a test.

Can you clarify what you mean by making this work on all platforms?  This fix is in cross-platform code, and should fix the problem in both Safari and Chrome on Windows.  As Chris said, the Mac accessibility code doesn't exercise this code path.

I thought it would be better to add a cross-platform test.  Would you prefer a Windows-specific test at the MSAA level, or both?
Comment 7 Darin Adler 2009-12-15 14:31:40 PST
(In reply to comment #6)
> Can you clarify what you mean by making this work on all platforms?  This fix
> is in cross-platform code, and should fix the problem in both Safari and Chrome
> on Windows.  As Chris said, the Mac accessibility code doesn't exercise this
> code path.

Sounds fine.

> I thought it would be better to add a cross-platform test.  Would you prefer a
> Windows-specific test at the MSAA level, or both?

Cross-platform test is great. MSAA test would be a nice plus, but do we have any of those?
Comment 8 Dominic Mazzoni 2009-12-16 15:02:03 PST
Created attachment 45017 [details]
Improved patch, adds an isChecked method to AccessibilityUIElement
Comment 9 Dominic Mazzoni 2009-12-16 15:02:29 PST
As it turns out, there isn't a way to get at isChecked() or the object's MSAA state from a LayoutTest currently, so I added a new method to AccessibilityUIElement and separate implementations for win, mac, and gtk.  Does this look right or did I miss an easier way?

This works on the Mac, and I'm working on testing GTK.  I still need to write an equivalent function for chromium's test_shell that I can try to submit in parallel.

I'm using VS 2008, so I'm having trouble running the layout tests on Windows.  Is there a try bot I can use?  Or is someone willing to test this patch on Windows for me?
Comment 10 WebKit Review Bot 2009-12-16 15:02:46 PST
Attachment 45017 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp:291:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 1
Comment 11 chris fleizach 2009-12-16 15:05:52 PST
your methodology looks pretty good to me.
Comment 12 Dominic Mazzoni 2009-12-17 14:53:22 PST
Created attachment 45105 [details]
All tests pass; source synced.
Comment 13 WebKit Review Bot 2009-12-17 14:58:18 PST
style-queue ran check-webkit-style on attachment 45105 [details] without any errors.
Comment 14 Dominic Mazzoni 2009-12-17 14:59:16 PST
Hi all,

I confirmed that this test passes on Windows and Mac OS X.  I re-synced and fixed the style guide error.

I also have a corresponding patch to Chromium under review, but it doesn't need to be committed in parallel because that whole directory of layout tests is currently skipped under chromium: http://codereview.chromium.org/503050

So, I hope this is ready to go?  Please take another look.

This is my first webkit patch, so please let me know anything else I should check; otherwise if it looks good, I'd appreciate it if you could tag it to be committed!

Thanks,
Dominic
Comment 15 Dominic Mazzoni 2009-12-18 08:57:04 PST
I'm syncing and re-uploading the patch now.
Comment 16 Dominic Mazzoni 2009-12-18 08:59:21 PST
Created attachment 45153 [details]
Re-synced and updated patch
Comment 17 WebKit Review Bot 2009-12-18 09:02:44 PST
style-queue ran check-webkit-style on attachment 45153 [details] without any errors.
Comment 18 Maciej Stachowiak 2009-12-28 01:46:50 PST
Comment on attachment 45153 [details]
Re-synced and updated patch

I think the correct behavior is that if an element both has native checkedness (e.g. because it is an input element of type radio or checkbox), then the checked attribute should take precedence over aria-checked, because <input type=radio> and <input type=checkbox> have "strong native semantics". Your patch seems to do it the other way around. Please fix this and provide an updated patch. Thanks!

Reference: http://dev.w3.org/html5/spec/Overview.html#annotations-for-assistive-technology-products-aria
Comment 19 Dominic Mazzoni 2009-12-31 10:32:42 PST
You're right, thanks.  I modified the test to check the interaction of <input type="checkbox"> with the "checked" attribute and the "aria-checked" attribute, and confirmed that the Mac version is already working correctly (ignoring aria-checked).  I'll make the Windows version match that next week after the holiday.  Thanks.
Comment 20 Dominic Mazzoni 2010-01-04 17:13:26 PST
Created attachment 45846 [details]
Makes native checkedness take precedence when checking for aria-checked. Now tests all permutations of checked and aria-checked.
Comment 21 WebKit Review Bot 2010-01-04 17:15:06 PST
style-queue ran check-webkit-style on attachment 45846 [details] without any errors.
Comment 22 Darin Adler 2010-01-04 17:24:39 PST
Comment on attachment 45846 [details]
Makes native checkedness take precedence when checking for aria-checked. Now tests all permutations of checked and aria-checked.

> +        if (equalIgnoringCase(getAttribute(aria_checkedAttr).string(), "true"))

You should omit the .string() here.

>      bool isRequired() const;
>      bool isSelected() const;
>      bool isExpanded() const;
> +    bool isChecked();

Why not const?

>      int hierarchicalLevel() const;
>      double clickPointX();
>      double clickPointY();

> +bool AccessibilityUIElement::isChecked()
> +{
> +    return static_cast<bool>(intValue());
> +}

Normally an int to bool conversion would not require an explicit cast.

> +    return (intValue() == 1);

No need for the parentheses here.

> +    return (vState.lVal & STATE_SYSTEM_CHECKED);

Or here.

r=me
Comment 23 Dominic Mazzoni 2010-01-04 17:40:42 PST
Created attachment 45850 [details]
Address review comments
Comment 24 Dominic Mazzoni 2010-01-04 17:42:30 PST
Thanks!  All changes made except:

> >      bool isRequired() const;
> >      bool isSelected() const;
> >      bool isExpanded() const;
> > +    bool isChecked();
>
> Why not const?

Because the Mac implementation calls intValue, which isn't const.
Comment 25 chris fleizach 2010-01-04 17:44:45 PST
> Because the Mac implementation calls intValue, which isn't const.

seems like intValue() could be const.
Comment 26 Dominic Mazzoni 2010-01-04 18:09:46 PST
Created attachment 45853 [details]
Easier than I thought.  Made both intValue and isChecked const.
Comment 27 WebKit Review Bot 2010-01-04 21:56:01 PST
style-queue ran check-webkit-style on attachment 45853 [details] without any errors.
Comment 28 WebKit Commit Bot 2010-01-05 11:00:41 PST
Comment on attachment 45853 [details]
Easier than I thought.  Made both intValue and isChecked const.

Clearing flags on attachment: 45853

Committed r52809: <http://trac.webkit.org/changeset/52809>
Comment 29 WebKit Commit Bot 2010-01-05 11:00:54 PST
All reviewed patches have been landed.  Closing bug.