New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE8 + iframe: window goes to background #2821

Closed
pbosakov opened this Issue Oct 24, 2011 · 4 comments

Comments

Projects
None yet
2 participants
@pbosakov
Contributor

pbosakov commented Oct 24, 2011

When a jquery mobile page is loaded in an iframe, it causes IE8 browser window to lose focus.

Affected system:
Windows XP Professional SP3
Microsoft Internet Explorer 8

Steps to reproduce:

  1. Open any (non-minimized) application window in the background
  2. Open IE8 in the foreground, with only one browsing tab
  3. Go to http://www.bossakov.eu/temp/jqm-ifr-test/

Result:
The whole IE window goes in the background when the jquery mobile code executes.

Expected result:
The IE window should stay in the foreground.

@pbosakov

This comment has been minimized.

Show comment
Hide comment
@pbosakov

pbosakov Oct 25, 2011

Contributor

Traced the issue to line 3028:

$( document.activeElement || "" ).add( "input:focus, textarea:focus, select:focus" ).blur();

Apparently in IE8, activeElement returns the body element, and using the blur() method on it causes this behaviour.

On my website I replaced this line with the following code. You may verify and possibly commit it.

if(document.activeElement) {
if(document.activeElement.nodeName.toLowerCase() != 'body') {
document.activeElement.blur();
}
} else {
$( "input:focus, textarea:focus, select:focus" ).blur();
}

Contributor

pbosakov commented Oct 25, 2011

Traced the issue to line 3028:

$( document.activeElement || "" ).add( "input:focus, textarea:focus, select:focus" ).blur();

Apparently in IE8, activeElement returns the body element, and using the blur() method on it causes this behaviour.

On my website I replaced this line with the following code. You may verify and possibly commit it.

if(document.activeElement) {
if(document.activeElement.nodeName.toLowerCase() != 'body') {
document.activeElement.blur();
}
} else {
$( "input:focus, textarea:focus, select:focus" ).blur();
}

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker Oct 28, 2011

Contributor

Thanks for tracking this down. Mind making a pull request?

Contributor

toddparker commented Oct 28, 2011

Thanks for tracking this down. Mind making a pull request?

@pbosakov

This comment has been minimized.

Show comment
Hide comment
@pbosakov

pbosakov Oct 28, 2011

Contributor

Sure, I'll make a pull request as soon as I can. Thanks

Contributor

pbosakov commented Oct 28, 2011

Sure, I'll make a pull request as soon as I can. Thanks

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker Nov 13, 2011

Contributor

Closed by: 8387919

Contributor

toddparker commented Nov 13, 2011

Closed by: 8387919

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment