Closed Bug 682790 Opened 9 years ago Closed 9 years ago

ignore implicit label association when it's associated explicitly

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: surkov, Assigned: surkov)

References

(Blocks 2 open bugs)

Details

(Keywords: access, Whiteboard: [good first bug])

Attachments

(1 file)

If @for attribute (explicit label association) is used then don't create relations for label content (implicit association).

See http://www.w3.org/TR/html4/interact/forms.html#h-17.9.1

"for = idref [CS]
    This attribute explicitly associates the label being defined with another control. When present, the value of this attribute must be the same as the value of the id attribute of some other control in the same document. When absent, the label being defined is associated with the element's contents. "

Example,
<label for="btn"><input type="button" id="btn" value="button"></label>
This results in duped name and accessible relations.
the fix should be resided in AccIterator.cpp HTMLLabelIterator::Next(), we shouldn't pick up implicit association if @for attribute is presented on label. 

mochitest: name/test_general.html and relations/test_general.html under label section, couple examples is enough:
<label for="btn"><input type="button" id="btn" value="button"></label>
<label for="btn"><input type="button" value="button2"></label>
Is this a dup of bug 669312?
Duplicate of this bug: 669312
(In reply to James Teh [:Jamie] from comment #2)
> Is this a dup of bug 669312?

right, thank you, Jamie.
this bug can be seen
1) http://www.html5accessibility.com/tests/form-labels.html (example from bug 669312)
2) facebook.com (log in button)
Blocks: rela11y
(In reply to alexander surkov from comment #0)
> If @for attribute (explicit label association) is used then don't create
> relations for label content (implicit association).
> 
> See http://www.w3.org/TR/html4/interact/forms.html#h-17.9.1
> 
> "for = idref [CS]
>     This attribute explicitly associates the label being defined with
> another control. When present, the value of this attribute must be the same
> as the value of the id attribute of some other control in the same document.
> When absent, the label being defined is associated with the element's
> contents. "
> 
> Example,
> <label for="btn"><input type="button" id="btn" value="button"></label>
> This results in duped name and accessible relations.

Marco asked me in the dupe of this bug whether I have seen this pattern used in the wild (https://bugzilla.mozilla.org/show_bug.cgi?id=669312#c1) I have recently noticed it on Google sites:(https://sites.google.com/)
example:

<label for="search-site"><input type="checkbox" onclick="JOT_postEvent('onSearchConfigChange');" id="search-site" jotid="search-site"> this site</label>
Attached patch patchSplinter Review
Attachment #560878 - Flags: review?(marco.zehe)
Comment on attachment 560878 [details] [diff] [review]
patch

r=me, thanks!
Attachment #560878 - Flags: review?(marco.zehe) → review+
https://hg.mozilla.org/mozilla-central/rev/7134aa74087d
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.