[whatwg] LABEL and radio/checkbox onclick
Matthew Raymond
mattraymond at earthlink.net
Sun Jul 18 14:49:06 PDT 2004
Matthew Thomas wrote:
> On 19 Jul, 2004, at 3:17 AM, Matthew Raymond wrote:
>
>> ...
>> The W3C HTML 4.01 specification makes it pretty clear that a label
>> passes focus to the control with which it is associated.
>
> The W3C is frequently wrong about UI details. Here, for example, firstly
> they failed to recognize that in native applications on any platform,
> clicking the label for a listbox (aka <select multiple>) or text field
> will not focus the field.
Are you suggesting we change HTML spec behavior here? If so, can you
explain why this specific behavior is undesirable beyond the fact that
it's not a standard Mac behavior?
> Secondly, they failed to recognize that in all extant versions of Mac
> OS, most native controls (including checkboxes, radio buttons, and
> option menus) could *never* be focused, even when you clicked on them.
[Snipped part about features for the disabled.]
Web pages are a special GUI case where behavior needs to be as
consistent as possible across all platforms. Web authors need to know
that the way their page behaves on their own platform is going to be the
the same on all other platforms. If you start changing the rules for
each platform, it only encourages webmasters to target specific
platforms like Windows. (BTW, although I'd love to have a Mac, I am not
in possession of one, so can someone let me know if any Mac OS X
browsers don't follow HTML spec behavior for label focus.)
>> As a result, I think it should always be the case that clicking the
>> label gives the associated control focus.
>
> As described above, that makes no sense for most OS X users.
As I stated above, it makes perfect sense for cross-platform content
to behave the same way on all platforms. Also, I don't think you have
properly explained how Mac users are harmed by having focus as opposed
to not having focus. Is focus really such a problem that it needs to be
removed?
>> If web authors don't want this to be the case, they should just use
>> text instead of <label>.
>
> That doesn't produce the desired result if I style <label> (for example,
> label {font-family: sans-serif}), but I don't want labels to act weirdly
> (passing focus in a way that labels in native applications do not).
>
> I could use <label> to label checkboxes and radiobuttons, and <span
> class="label"> to label every other kind of control, to make the labels
> behave properly, and then style both elements, but having to do that to
> work around a bug in the spec would be pretty annoying.
It's a trivial amount of CSS to and HTML to do what you're talking
about:
<style><!-- .class { font-family: sans-serif; } --></style>
...
<span class="label">Label</span>
Besides, this kind of workaround is pretty silly just to avoid focus
on controls when a label is clicked. Was there some other behavior you
wanted to happen when they click the label? Or perhaps you're worried
about them clicking on something above the label, which then goes away,
then the user clicks again, resulting in a catastrophic change of focus
to the associated control! Oh, the humanity!!!
/me shows famous film of Hindenburg disaster.
> Therefore, my suggestion stands.
It's what it's standing on that I'd like to know...
More information about the whatwg
mailing list