There are times that I really hate Internet Explorer

I’m working on putting some band-aid fixes into an application supplied to work by an outside vendor. For various reasons, I can’t say who, which I really think is a shame, but…

Anyway, one of the problems with this web app is that it is highly stateful. It can’t handle people doing double-clicks of links and so forth (as in the app breaks if they do). So, to band-aid that, we want to have the links disable themselves after clicking.

What we decided to do is make the link(s) disabled. This is trivial to do under JavaScript. So we wrote some test code, and sure enough, the link was disabled (you could tell because it was greyed out). However, you could still click on the bloody things

Quoting from the MSDN description of the disabled property:

When an element is disabled, it appears dimmed and does not respond to user input. Disabled elements do not respond to mouse events, nor will they respond to the contentEditable property.

I guess I shouldn’t complain too much; according to the W3C’s DOM spec and the HTML 4.0 spec, anchors shouldn’t even support the disabled property; this is a Microsoftism. However, seeing as how it does, it should at least support it properly.

What makes it even sillier, however, is that if the anchor tag is disabled, I can click on it and the onClick event fires, so I can trap it (and cancel it). However, if I disable the entire body tag (thus disabling the whole page), I can still click on the link, but the onClick event for the tag won’t fire… the browser just goes to the target page. Go figure.

This wasted a good 2 hours of my time this afternoon, largely because I couldn’t get over how silly this was. Tomorrow, I’ll just move on, I think…

Author: Robert Watkins

My name is Robert Watkins. I am a software developer and have been for over 20 years now. I currently work for people, but my opinions here are in no way endorsed by them (which is cool; their opinions aren’t endorsed by me either). My main professional interests are in Java development, using Agile methods, with a historical focus on building web based applications. I’m also a Mac-fan and love my iPhone, which I’m currently learning how to code for. I live and work in Brisbane, Australia, but I grew up in the Northern Territory, and still find Brisbane too cold (after 22 years here). I’m married, with two children and one cat. My politics are socialist in tendency, my religious affiliation is atheist (aka “none of the above”), my attitude is condescending and my moral standing is lying down.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: