Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit b332bcd

Browse files
committed
Transition: do not set page focus on inital load to prevent jumping pages when in iframes
1 parent 85d3158 commit b332bcd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

js/transitions/transition.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ define( [ "jquery",
6363
this.deferred.resolve( this.name, this.reverse, this.$to, this.$from, true );
6464
},
6565

66-
doneOut: function( screenHeight, reverseClass, none ) {
66+
doneOut: function( screenHeight, reverseClass, none, preventFocus ) {
6767
this.beforeDoneOut();
68-
this.startIn( screenHeight, reverseClass, none );
68+
this.startIn( screenHeight, reverseClass, none, preventFocus );
6969
},
7070

7171
hideIn: function( callback ) {
@@ -90,12 +90,14 @@ define( [ "jquery",
9090
}, 150 );
9191
},
9292

93-
startIn: function( screenHeight, reverseClass, none ) {
93+
startIn: function( screenHeight, reverseClass, none, preventFocus ) {
9494
this.hideIn(function() {
9595
this.$to.addClass( $.mobile.activePageClass + this.toPreClass );
9696

9797
// Send focus to page as it is now display: block
98-
$.mobile.focusPage( this.$to );
98+
if( !preventFocus ){
99+
$.mobile.focusPage( this.$to );
100+
}
99101

100102
// Set to page height
101103
this.$to.height( screenHeight + this.toScroll );
@@ -153,7 +155,7 @@ define( [ "jquery",
153155
if ( this.$from && !none ) {
154156
this.startOut( screenHeight, reverseClass, none );
155157
} else {
156-
this.doneOut( screenHeight, reverseClass, none );
158+
this.doneOut( screenHeight, reverseClass, none, true );
157159
}
158160

159161
return this.deferred.promise();

0 commit comments

Comments
 (0)