Closed
Bug 477572
Opened 16 years ago
Closed 16 years ago
Properly support indeterminate checkboxes with the right a11y notifications
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
FIXED
People
(Reporter: Waldo, Assigned: MarcoZ)
References
()
Details
(Keywords: access)
Attachments
(1 file, 1 obsolete file)
6.04 KB,
patch
|
surkov
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
Basically, there's an "indeterminate" property on checkboxes, and when it's set the checkbox is in a special state that's neither checked nor unchecked. The checkbox shouldn't appear to screen readers or such creatures as checked or unchecked, because it's really neither.
See the URL for a description of the DOM property and a test page that demonstrates it.
Reporter | ||
Comment 1•16 years ago
|
||
Actually, the original URL described it but didn't like to the page that demonstrated it, choosing to put a screenshot in but no link. :-) Changing to the actual test page instead...
Assignee | ||
Comment 2•16 years ago
|
||
The testcase shows that, for the indeterminate checkbox, we currently expose the "checked" state. We should expose nsIAccessibleStates::STATE_MIXED instead if that DOM property is true.
Keywords: access
Assignee | ||
Comment 3•16 years ago
|
||
I confirmed that this does what it is supposed to. Need to write mochitest. Is this the right approach?
Assignee: nobody → marco.zehe
Status: NEW → ASSIGNED
Attachment #361267 -
Flags: review?(surkov.alexander)
Comment 4•16 years ago
|
||
Yes, sounds correct. Would be nice to see deepened bug where this property was implemented. You could use test_nsIAccessible_states.html (as well you might to rename it to test_states.html).
There is another point. We expose "check"/"uncheck" action name, which action name should be reserved for indeterminate state?
Assignee | ||
Comment 5•16 years ago
|
||
Patch that includes a mochitest. Starts out with checked, then sets to unchecked, then sets to indeterminate.
Robert, is this the right way to call the two interfaces, or is there a more elegant way to do it?
Attachment #361267 -
Attachment is obsolete: true
Attachment #361277 -
Flags: superreview?(roc)
Attachment #361277 -
Flags: review?(surkov.alexander)
Attachment #361267 -
Flags: review?(surkov.alexander)
Comment 6•16 years ago
|
||
Do I understand correct indeterminate checkboxes don't work without JS?
Marco, what about actions and events? Do you prefer to save this for another bug?
Depends on: 123836
Comment 7•16 years ago
|
||
Comment on attachment 361277 [details] [diff] [review]
Patch with mochitest
>+ PRBool mixed = PR_FALSE; // or mixed.
>
>+ nsCOMPtr<nsIDOMNSHTMLInputElement>
>+ html5CheckboxElement(do_QueryInterface(mDOMNode));
technicaly NS is not html5.
>+ if (html5CheckboxElement) {
>+ html5CheckboxElement->GetIndeterminate(&mixed);
>+
>+ if (mixed)
>+ *aState |= nsIAccessibleStates::STATE_MIXED;
If I get right once we are mixed then we can't be checked. We don't need to call GetChecked().
>+ checkboxElem.checked = false;
>+ testStates(checkboxElem, 0, 0, STATE_CHECKED);
>+ checkboxElem.indeterminate = true;
>+ testStates(checkboxElem, STATE_MIXED, 0, STATE_CHECKED);
I would prefer to have markup (not js) based tests but it seems "indeterminate" is available from script only. There is no "indeterminate" attribute?
>+ <input type="checkbox" id="check1" name="check1" value="I agree" checked="true"/>
why do you tend to give @name attribute for every form control?
Assignee | ||
Comment 8•16 years ago
|
||
(In reply to comment #6)
> Do I understand correct indeterminate checkboxes don't work without JS?
Alex, as far as I understand it from this blog post:
https://developer.mozilla.org/web-tech/2009/02/05/a-new-checkbox-type/, yes, this is assigned through JS.
> Marco, what about actions and events? Do you prefer to save this for another
> bug?
I didn't see any problem with events. When focused on a partially checked checkbox and pressing SPACE, like on the test page, the state goes to "not checked", which may be specific to this scenario.
And that brings me to actions: We never know if pressing SPACE on a partially checked checkbox will check or uncheck the whole thing. This is determined by the web app, so I am not sure what the actions should be here. I'd prefer to discuss this and move that part to another bug, but get the state exposed properly.
Assignee | ||
Comment 9•16 years ago
|
||
(In reply to comment #7)
> (From update of attachment 361277 [details] [diff] [review])
>
> >+ PRBool mixed = PR_FALSE; // or mixed.
> >
> >+ nsCOMPtr<nsIDOMNSHTMLInputElement>
> >+ html5CheckboxElement(do_QueryInterface(mDOMNode));
>
> technicaly NS is not html5.
Well, this is the interface that implements the HTML 5 specific property, so I wanted to make clear that we're dealing with something HTML-5-specific here.
>
> >+ if (html5CheckboxElement) {
> >+ html5CheckboxElement->GetIndeterminate(&mixed);
> >+
> >+ if (mixed)
> >+ *aState |= nsIAccessibleStates::STATE_MIXED;
>
> If I get right once we are mixed then we can't be checked. We don't need to
> call GetChecked().
OK, will return at the end of this if block if we're setting the state.
> I would prefer to have markup (not js) based tests but it seems "indeterminate"
> is available from script only. There is no "indeterminate" attribute?
See my other comment: As far as I understood, this is a JS only thing right now.
> >+ <input type="checkbox" id="check1" name="check1" value="I agree" checked="true"/>
>
> why do you tend to give @name attribute for every form control?
Dunno, something I learned to do once in my HTML course at university, and it stuck.
Comment 10•16 years ago
|
||
(In reply to comment #7)
> I would prefer to have markup (not js) based tests but it seems "indeterminate"
> is available from script only. There is no "indeterminate" attribute?
Correct, this is how its defined in HTML5 and also how it works in Webkit.
Attachment #361277 -
Flags: superreview?(roc) → superreview+
Comment 11•16 years ago
|
||
(In reply to comment #8)
> I didn't see any problem with events. When focused on a partially checked
> checkbox and pressing SPACE, like on the test page, the state goes to "not
> checked", which may be specific to this scenario.
If I get right we should fire mixed state change event.
Comment 12•16 years ago
|
||
Comment on attachment 361277 [details] [diff] [review]
Patch with mochitest
r=me
please file following up bugs.
Attachment #361277 -
Flags: review?(surkov.alexander) → review+
Assignee | ||
Comment 13•16 years ago
|
||
Pushed in changeset:
http://hg.mozilla.org/mozilla-central/rev/61880bdd4594
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 14•16 years ago
|
||
Marco, I see you filed bug 477975 for actions, should this bug be used for a11y state change events or do you plan to file new one?
You need to log in
before you can comment on or make changes to this bug.
Description
•