RESOLVED FIXED 7255
label attribute in option elements is ignored
https://bugs.webkit.org/show_bug.cgi?id=7255
Summary label attribute in option elements is ignored
John Sullivan
Reported 2006-02-14 12:14:14 PST
The OPTION element has a "label" attribute which, when present, is supposed to be used in the user interface rather than the text contents of the element. This is described on <http://www.w3.org/TR/REC-html40/interact/forms.html>: This attribute allows authors to specify a shorter label for an option than the content of the OPTION element. When specified, user agents should use the value of this attribute rather than the content of the OPTION element as the option label. WebKit ignores this attribute, though a getter and setter are supplied in the Objective-C DOM API at least. IE supports this attribute, though Firefox ignores it. Here's an example. This should show a pop-up menu with menu items titled "1" and "2", but instead it shows a pop-up menu with long menu item titles: <select> <option value="1" label="1">the label for this element is "1"</option> <option value="2" label="2">the label for this element is "2"</option> </select>
Attachments
test cases that include empty label (282 bytes, text/html)
2006-02-14 12:28 PST, John Sullivan
no flags
patch to support label attribute for OPTION elements (953 bytes, patch)
2006-02-14 12:31 PST, John Sullivan
adele: review+
layout tests for patch (1.09 KB, text/plain)
2006-02-14 13:26 PST, John Sullivan
no flags
John Sullivan
Comment 1 2006-02-14 12:28:37 PST
Created attachment 6487 [details] test cases that include empty label
John Sullivan
Comment 2 2006-02-14 12:31:11 PST
Created attachment 6488 [details] patch to support label attribute for OPTION elements
John Sullivan
Comment 3 2006-02-14 12:37:50 PST
Comment on attachment 6488 [details] patch to support label attribute for OPTION elements Oops, I didn't mean to mark it review-+. Also, I haven't attached the layout tests yet, so I'll set this to review- until I have the tests ready.
John Sullivan
Comment 4 2006-02-14 13:26:54 PST
Created attachment 6489 [details] layout tests for patch
John Sullivan
Comment 5 2006-02-14 13:27:29 PST
Comment on attachment 6488 [details] patch to support label attribute for OPTION elements Now that I've attached the new layout tests, this is ready for review.
Dave Hyatt
Comment 6 2006-02-14 14:07:08 PST
HTML also will let you write: <option label>Foo</option> Should make sure we match WinIE in that situation too.
Dave Hyatt
Comment 7 2006-02-14 14:07:33 PST
Also, what about list boxes? Need to see if label is used for <select size="10"> for example.
Dave Hyatt
Comment 8 2006-02-14 14:07:47 PST
Also need to test optgroups.
John Sullivan
Comment 9 2006-02-14 14:18:19 PST
In response to comment 6: the behavior for this case is the same on MacIE as in WebKit; I'll add a layout test. In response to comment 7: list boxes don't use the label but should; I'll write a bug In response to comment 8: optgroups already deal with the label (used as hierarchical menu item title)
John Sullivan
Comment 10 2006-02-14 14:38:38 PST
I was wrong about list boxes in my previous comment; they do work correctly now with label attributes. (I was using the wrong Safari when I tested that case.) I'm adding another layout test for this.
Note You need to log in before you can comment on or make changes to this bug.