Timbru

Gabriel Radic

Timbru header image 2

Check-boxes and negative text-indent in Safari

November 27th, 2003 · 6 Comments · EN, Epinions

Update, 27th of April 2005: This is fixed in the new Safari 1.3 for Mac OS 10.3.9, which is supposed to be using the same parser as Safari 2.0 for Tiger.

I’ve recently run into a very annoying Safari rendering problem. It involves checkable input elements on a block with text-indent: negativeValue and other block elements inside. If the radio-button or check-box is outside the content area, it can’t be clicked.

You can see an example below. It’s an iframe, so you can simply View Source if you right-click inside.

Try to activate each check-box, you will notice the following:

  • the problem occurs only for elements that have a block element brother and are on the indentation/padding area; this means I and III
  • I.1, I.2 and III.1 work because their container element has no block element children.
  • IIIb also works because it’s inside the content area.

I know that using negative alignment values puts the elements outside the content area, and this may make Safari’s rendering technically correct. However, letting the input elements have a life outside the content area may be correct as well, it’s what other browsers do and the behaviour any reasonable person would expect.

It’s a shame, because AFAIK this is the finest way to build a list of checkbox/radio buttons. It’s also a shame because my boss – recent switcher – would run our product demos with Safari instead of Camino and most important because I already use it in our pricing application web interface :-(

PS: I know the above paragraph may be classified as whining, but this is more that a bug report, it’s a post on my web log.

PPS: I just discovered the weirdest thing: if you click or select some text in the block element that contains the input element, you can then check the element. It’s like clicking the LI brings the element on-top. Weird.

Tags:

6 responses so far ↓

  • 1 Fred Henle // Jan 14, 2005 at 20:48

    The solution is to combine the negative value for text-indent with an identical (but positive) value for padding-left.

  • 2 Gabriel Radic // Jan 17, 2005 at 10:30

    Fred, that is why the _problem_ occurs.

    You didn’t even read the title, did you?

  • 3 Fred Henle // Jan 17, 2005 at 15:43

    I *do* understand the problem, and I also understand the solution. See

    http://monet.mercersburg.edu/henle/safari/text-indent.html

    for a demonstration. We want to use a negative value for text-indent because it looks good, but it causes problems with Safari (and other khtml based browsers like Konqueror) in that the checkboxes aren’t clickable… *unless* it is combined with a positive value for padding-left, which fixes everything.

  • 4 Gabriel Radic // Jan 17, 2005 at 17:28

    Fred, the padding in my example is set just like in yours, but in my case it doesn’t fix it. Right-click in the example area to see the source.

    I’m lost, again. Any ideas?

  • 5 Fred Henle // Jan 17, 2005 at 23:22

    Sorry, I didn’t realize that you were already using padding-left! However, after some time fiddling with your example I was able to get it to work. I closed the LI elements before starting the nested ULs, and adjusted the padding and margins a little. I put my modified version at

    http://monet.mercersburg.edu/henle/safari/ul-li.html

    Fred

  • 6 Florian Bischof // Aug 18, 2005 at 18:21

    Apple fixed this bug, but if a checkbox has a negative padding and is floated you still can’t click it…

    http://fxb.de/bugs/safari/padding-checkbox.html

    Needless to say, it works perfectly on Firefox, Internet Explorer and Konqueror.

Leave a Comment