Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Fixes #3505 (v2) Calling focus on hidden elements breaks page on ie8 #3555

wants to merge 1 commit into from

3 participants


No description provided.



So in reviewing your commit I noticed that we make two calls to $.mobile.focusPage for some reason. One in the doneOut callback in the transitions module and another in the navigation module in the promise resolution callback. Right near the second call I noticed a comment referencing issue here. It appears I already fixed this issue before the transitions module was created (fix) and all we really needed to do was remove the call in the doneOut callback.

I pushed the a commit that should fix this and it appears to work just fine after testing in ie8


I credited you with the commit since you did all the work, but if you could test and verify that does indeed work I think we can close the issue for good.


Hi @johnbender,
I've reviewed/tested your fix and confirm it works like a charm. Actually, you can see that this is equal to my pull request v1 except additional double-safety try/catch part. So I think you should accept your commit only; my changes in this pull request are not required after your change. Pls let me know if anything else is required from my side.
Just FYI: the idea if this PR (v2) was to save early call of focusPage, I thought there was a reason for doing this, especially when I found alreadyFocused parameter. Good to know it is not important.

@Wilto Wilto closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 4 deletions.
  1. +6 −4 js/
10 js/
@@ -22,6 +22,7 @@ function outInTransitionHandler( name, reverse, $to, $from ) {
viewportClass = "ui-mobile-viewport-transitioning viewport-" + name,
maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $( window ).width() > $.mobile.maxTransitionWidth,
none = !$.support.cssTransitions || maxTransitionOverride || !name || name === "none",
+ alreadyFocused = false,
doneOut = function() {
if ( $from ) {
@@ -34,11 +35,12 @@ function outInTransitionHandler( name, reverse, $to, $from ) {
if( !none ){
$to.animationComplete( doneIn );
+ // Send focus to page as it is now display: block
+ // For browsers not supported transitions or if transition is not set we will set focus later (#3505)
+ $.mobile.focusPage( $to );
+ alreadyFocused = true;
- // Send focus to page as it is now display: block
- $.mobile.focusPage( $to );
// Jump to top or prev scroll, sometimes on iOS the page has not rendered yet.
$to.height( screenHeight + toScroll );
@@ -58,7 +60,7 @@ function outInTransitionHandler( name, reverse, $to, $from ) {
.height( "" )
.parent().removeClass( viewportClass );
- deferred.resolve( name, reverse, $to, $from, true );
+ deferred.resolve( name, reverse, $to, $from, alreadyFocused);
Something went wrong with that request. Please try again.