IE’s event transparency logic

In IE you can sometimes click "through" an element and activate something that is underneath. We've been pondering for a while what the exact behaviour is (and so have the Mozilla devs).

After several test files and experiments, I think I've nailed it – here are IE's event transparency rules. If I have missed anything or you notice a scenario that isn't according to these rules please let me know.

General rules

IE considers an area of an element "transparent" if

a) the computed style of the "background-color" is "transparent"
b) the computed style of "background-image" is "none"
c) it is outside the inline boxes generated by element contents (not counting line-height)
d) it is outside the element's borders (including invisible table borders)


e) it is outside a CSS clip rectangle


f) if "visibility" is "hidden"

Event processing

When a mouse event occurs above a transparent area of the initial target, IE checks the elements in stacking order.

While the current event target area is transparent according to the rules above and is not BODY, IE examines the element below.

If current event target is BODY the topmost element gets the event.

If current event target area is not transparent it will get the event if the event is within a content box or on a border. Otherwise, the event goes to the initial target.

Special cases that are transparent to events:

PNG with alpha channel and the AlphaImageLoader filter applied – the fully transparent areas

IFRAME with attribute allowtransparency and contents with style background: transparent applied

Transparent parts of OBJECT with wmode=transparent


Clipping does make the clipped region transparent even if the element has backgrounds/background images

Opacity filters and background-position/repeat have no effect on transparency for event handling purposes.

If the event does not reach the BODY element because the target point is positioned outside the BODY, it will go to the bottom-most element, normally HTML.

Line-height does not affect transparency – the extra space inbetween the lines is transparent to events

Table elements are never transparent to events


2 thoughts on “IE’s event transparency logic

  1. I should have mentioned that this research owes a lot to intelligent questions from Ian.We'll probably cover "event transparency" in WHAT and it will then presumably be implemented in Opera and Mozilla. That means no more problems with invisible DIVs that by accident overlay the page and makes everything unclickable! 🙂

  2. This will be another brain-damaged part of WHAT (another one is going to be the offsetParent logic). Let's do it because IE does. Of course, it's better to have it documented because every browser vendor does reverse engineering anyway, but it just feels sad to have such things standardized.

Leave a Reply

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

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s