ignore implicit label association when it's associated explicitly

RESOLVED FIXED in mozilla10

Status

()

defect
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: surkov, Assigned: surkov)

Tracking

(Blocks 2 bugs, {access})

unspecified
mozilla10
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [good first bug])

Attachments

(1 attachment)

Assignee

Description

8 years ago
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.
Assignee

Comment 1

8 years ago
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?
Assignee

Updated

8 years ago
Duplicate of this bug: 669312
Assignee

Comment 4

8 years ago
(In reply to James Teh [:Jamie] from comment #2)
> Is this a dup of bug 669312?

right, thank you, Jamie.
Assignee

Comment 5

8 years ago
this bug can be seen
1) http://www.html5accessibility.com/tests/form-labels.html (example from bug 669312)
2) facebook.com (log in button)
Assignee

Updated

8 years ago
Blocks: rela11y

Comment 6

8 years ago
(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>
Assignee

Comment 7

8 years ago
Posted patch patchSplinter Review
Attachment #560878 - Flags: review?(marco.zehe)

Comment 10

8 years ago
https://hg.mozilla.org/mozilla-central/rev/7134aa74087d
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.