IE's event transparency logic
Monday, 29. August 2005, 13:40:18
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"
AND
b) the computed style of "background-image" is "none"
AND
c) it is outside the inline boxes generated by element contents (not counting line-height)
AND
d) it is outside the element's borders (including invisible table borders)
OR
e) it is outside a CSS clip rectangle
OR
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
Notes
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










hallvors # 29. August 2005, 13:40
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!
feldgendler # 7. June 2006, 07:22