Skip to main content

Search and Top Navigation

#9420 closed bug (fixed)

Opened July 10, 2013 09:38PM UTC

Closed October 01, 2013 06:22AM UTC

Last modified November 26, 2013 08:44PM UTC

Dialog: Close causes blur of window in IE9

Reported by: rcogswell Owned by: rcogswell
Priority: minor Milestone: 1.10.4
Component: ui.dialog Version: 1.10.0
Keywords: Cc:
Blocked by: Blocking:
Description

The significant aspects for reproducing this are as follows:

click a link that triggers ...

1. the removal/replacement of the html for the link

2. opening a dialog

3. fade out the contents of the dialog

4. close the dialog

For IE 9 (and 7 and 8 simulated via IE 9 developer tools) with jquery ui 1.10 and up, the close of the dialog also causes a blur of the window. I've included a jsfiddle of the html to reproduce this, but it only reproduces the behavior as a standalone page -- even the embedded result wrapper is enough to prevent the buggy behavior.

I do not see this behavior in Firefox 3.6.22 or Chrome 27.

I do not see this behavior in jquery ui 1.9.2 or earlier.

It does not seem to matter which version of jquery I use (tried 1.6.3 and 1.10.2).

The behavior does NOT occur if I replace the fadeOut with a fadeTo to an opacity of .1.

The behavior DOES still occur even if I do a fadeIn after the fadeOut and before the dialog close.

The behavior does NOT occur if I click somewhere else on the page after clicking on the link during the fade (before the dialog close).

The behavior does NOT occur if the javascript does not remove the link originally clicked to trigger the javascript.

This is caused by the ".blur()" call in the following block of code from the ui-dialog close function:

if ( !this.opener.filter(":focusable").focus().length ) {

Hiding a focused element doesn't trigger blur in WebKit

so in case we have nothing to focus on, explicitly blur the active element

https:bugs.webkit.org/show_bug.cgi?id=47182

$( this.document[0].activeElement ).blur();

}

I suspect the fadeOut causes (once it reaches the hidden state) the activeElement to change to something that results in the blur acting on the window.

http://jsfiddle.net/nhQkZ/8/embedded/result/

Attachments (0)
Change History (10)

Changed July 11, 2013 03:04AM UTC by tj.vantoll comment:1

owner: → rcogswell
status: newpending

Hi rcogswell,

Thanks for taking the time to contribute to the jQuery UI project. I'm not seeing the behavior you're describing, but the behavior sounds similar to #8443. What do you mean by "causes blur of window"?

By the way you can view a jsFiddle without any embedding by appending "/show" to the URL. For example http://jsfiddle.net/nhQkZ/8/show.

Thanks.

Changed July 11, 2013 02:31PM UTC by rcogswell comment:2

status: pendingnew

Thanks for the jsFiddle tip -- I'm a jsFiddle newbie. I am able to reproduce the problem using http://jsfiddle.net/nhQkZ/8/show/. To see the issue the jsFiddle needs to be in its own browser window (no other tabs) and you need some other window open behind it. The other window could be another browser window or a window from a different application. By "causes blur of window", I mean that it behaves the same as if you had called "window.blur()", which if you have some other window behind the browser window causes the other window to receive focus and for the browser window to go behind the other window. The blur happens about one second after clicking the "Show Dialog" link (after the fadeOut finishes) as long as you don't click anything else..

Changed July 11, 2013 03:14PM UTC by tj.vantoll comment:3

status: newopen
summary: dialog close causes blur of windowDialog: Close causes blur of window in IE9

Ok I see it now. Before I only had one window open.

Changed July 11, 2013 03:29PM UTC by tj.vantoll comment:4

In this situation

document.activeElement
is the
<body>
.

In IE9 and IE10

document.body.blur()
causes the browser to switch windows o_O.

Changed September 16, 2013 12:46PM UTC by jzaefferer comment:5

That sounds similar to what this commit was addressing, in draggable: https://github.com/jquery/jquery-ui/commit/eae2c4b358af3ebfae258abfe77eeace48fcefcb

Changed September 16, 2013 12:47PM UTC by tj.vantoll comment:6

Replying to [comment:5 joern.zaefferer]:

That sounds similar to what this commit was addressing, in draggable: https://github.com/jquery/jquery-ui/commit/eae2c4b358af3ebfae258abfe77eeace48fcefcb

Yeah, it's the same problem.

Changed October 01, 2013 06:22AM UTC by TJ VanToll comment:7

resolution: → fixed
status: openclosed

Dialog: Safe activeElement access.

Fixed #9420 - Dialog: Close causes blur of window in IE9

Fixed #8443 - Dialog: "unspecified error" when using ie9 and iframe

Changeset: 2dfe85d3e2269a571e07bd550bbd838ee703b833

Changed October 01, 2013 06:23AM UTC by tj.vantoll comment:8

milestone: none1.11.0

Changed November 26, 2013 08:12PM UTC by TJ VanToll comment:9

Dialog: Safe activeElement access.

Fixed #9420 - Dialog: Close causes blur of window in IE9

Fixed #8443 - Dialog: "unspecified error" when using ie9 and iframe

(cherry picked from commit 2dfe85d3e2269a571e07bd550bbd838ee703b833)

Changeset: 29e8077871902a49f3039633a7fb9ac5c4093aa8

Changed November 26, 2013 08:44PM UTC by scottgonzalez comment:10

milestone: 1.11.01.10.4