User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:184.108.40.206) Gecko/20061204 (CK-IBM) Firefox/220.127.116.11 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:18.104.22.168) Gecko/20061204 (CK-IBM) Firefox/22.214.171.124 From http://www.w3.org/TR/html4/interact/forms.html#h-17.9: "More than one LABEL may be associated with the same control by creating multiple references via the for attribute." Firefox is only exposing the first label found to MSAA. Reproducible: Always Steps to Reproduce: 1.Create a page with the following HTML: <LABEL for="foo">Label one</LABEL> <LABEL for="foo">Label two</LABEL><INPUT id="foo"> 2.Use Inspect32 to investigate the MSAA name exposed for the input control Actual Results: "Label one" is returned. In general, it appears to find the first label and ignore the rest. Expected Results: MSAA:Name = "Label one Label two"
Workaround: note that aaa:labelledby accepts a list of ID's separated by a space, and can be used by HTML or XUL to have multiple label targets. Not a very good workaround for HTML since it's not supported bye other browsers right now, and we should just get <label> correct. Implemenation-wise, we won't want to walk the entire tree of objects. This means that whenever a label element is created, we should cache what it points to in a hash table so we can retrieve the relationship in reverse with an O(1) algorithm. However, we'll have to be careful to keep the cache updated as elements get removed and attributes change. That's a lot of work to do for this. I'm surprised IE 7 gets that right -- pretty impressive.
Sorry, I had Pete check that by phone since I didn't have an IE7 install, and I think he looked at the wrong field. I've since installed Vista to verify and it only displays the content of the second label - unless there's a difference between IE7 on XP and Vista. Therefore, support for this is broken in at least IE6, IE7 and Firefox 2. The only browser I'm aware of that supports this is Home Page Reader. I haven't tested Opera.
It's the kind of thing that's really hard to implement in a way that doesn't affect performance. It isn't common enough for anyone to care enough to do it the right way. There are so many other bigger issues. Ideally I'd like to see it fixed. In the mean time I'd use aaa:labelledby.
Mass un-assigning bugs assigned to Aaron.
fixed by bug 381599 (firefox 4 timeframe), tests in name/test_general.html ("btn_label_multi").