This is Joshua Wehner's archaic Blog

Safari vs. Safari: label

Prior to version 3 (now out of beta in Leopard), Safari was one of few mainstream browsers that didn't do anything when the user clicked on a HTML input elements label text.

Most browsers treat a label-click as an element-click – that is, they "pretend" the user clicked directly on the element itself. For text fields, this is sort of a weird novelty, but for radio buttons and checkboxes, it's a useful trick for expanding the "click area" of the element.

There are a variety of fixes out there. Unfortunately, the one I'm fond of is a bit too aggressive: it tries to solve this "problem" in all versions of Safari, including version 3, which already includes this behavior.

In other words, on a page with a "fix" for Safari 2's bad label behavior, if you click on a label in Safari 3, it's like clicking the element twice. Again, this is a novelty for text elements, but for checkboxes it's effectively a non-click. (Users may even see the check flicker briefly.)

The solution I've been using triggers on a fairly primitive UserAgent string check. I might try to make the trigger more sophisticated (it looks like Safari 3 adds a "Version" string that previous versions didn't have), but it's frustratingly hard to test this kind of thing – I don't think it's possible to run version 2 & 3 side-by-side on my Mac, which leaves solutions like BrowserCam as the only option.

Permalink • Posted in: apple, javascript, webComments (4)


Chris Dolan Oct 30, 2007

I haven't tried this, but perhaps you can get your hands on a nightly Safari 2.x build? I know that the nightlies are built with their own local WebKit, so they can coexist with the builtin Safari. Alternatively, if you have Tiger around still, maybe you can run a Safari 3.x nightly? Just speculation...

Joshua Oct 30, 2007

That's an interesting idea. I *thought* that WebKit nightlies had their own UserAgent, but I should look into it...

Andre Arko Dec 17, 2007

I use Multi-Safari, and it's great:

In 10.5.1 the older versions of Safari have problems, but a fixed copy of Safari 2.0.4 can be found here:

Joshua Dec 18, 2007

Very useful, thanks Andre!