Skip to main content

Bug Tracker

Side navigation

#4332 closed bug (invalid)

Opened March 11, 2009 07:31PM UTC

Closed March 31, 2011 05:48PM UTC

window focus event doesn't trigger on IE6

Reported by: segalerez@gmail.com Owned by:
Priority: major Milestone: 1.4
Component: event Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

Example:

$(window).bind('focus',function() {

$.jGrowl('Focus');

});

Works prefectly in Firefox, IE6 behaves in an unexpected manner.

Sometimes it triggers if an input inside gets focus. sometimes not. Sometimes when I switch to the window using Alt+Tab, sometimes not.

Attachments (0)
Change History (7)

Changed March 12, 2009 12:00AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

IE doesn't bubble several form events, including focus. jQuery doesn't control that. For reference, the events supported by

.live
reliably bubble to
window
in IE.

http://docs.jquery.com/Events/live#typefn

Changed March 12, 2009 12:43AM UTC by segalerez@gmail.com comment:2

resolution: invalid
status: closedreopened

I believe $(window).focus and $(window).blur should have special treatment - in IE using document.onfocusin and document.onfocusout.

See http://odondo.wordpress.com/2007/08/28/javascript-and-cross-browser-window-focus/

This is also an issue when the window have no form elements at all.

As a cross-browser library, jQuery should suggest a method of detecting when windows get/lose focus, the same way it does for mouseenter and mouseleave.

Changed March 12, 2009 03:09AM UTC by dmethvin comment:3

That enhancement is already on the roadmap for 1.4 and I think there's already a ticket although I can't find it at the moment:

http://docs.jquery.com/JQuery_1.4_Roadmap

In any case, it won't get lost, and it's working as currently documented. The docs actually specify that focus/blur aren't supported:

http://docs.jquery.com/Events/live#typefn

Changed April 22, 2009 01:36AM UTC by brandon comment:4

owner: brandon
status: reopenednew

Changed April 30, 2009 09:08PM UTC by brandon comment:5

I don't believe this bug has anything to do with live as discussed in the comments.

This blog post might shed some light on a possible solution: http://www.thefutureoftheweb.com/blog/detect-browser-window-focus

Changed November 18, 2010 03:33AM UTC by dmethvin comment:6

status: newopen

Changed March 31, 2011 05:48PM UTC by dmethvin comment:7

resolution: → invalid
status: openclosed

The focusin event bubbles, but not focus.