ignore implicit label association when it's associated explicitly

RESOLVED FIXED in mozilla10

Status

()

Core
Disability Access APIs
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: surkov, Assigned: surkov)

Tracking

(Blocks: 2 bugs, {access})

unspecified
mozilla10
access
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [good first bug])

Attachments

(1 attachment)

(Assignee)

Description

6 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

6 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>

Comment 2

6 years ago
Is this a dup of bug 669312?
(Assignee)

Updated

6 years ago
Duplicate of this bug: 669312
(Assignee)

Comment 4

6 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

6 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

6 years ago
Blocks: 475297

Comment 6

6 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

6 years ago
Created attachment 560878 [details] [diff] [review]
patch
Attachment #560878 - Flags: review?(marco.zehe)

Comment 8

6 years ago
Comment on attachment 560878 [details] [diff] [review]
patch

r=me, thanks!
Attachment #560878 - Flags: review?(marco.zehe) → review+
(Assignee)

Comment 9

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