Permalink
Browse files

[navigation] Handle the case where the initial url contains a dialog …

…hash key
  • Loading branch information...
1 parent d3cfce6 commit d93c65561b715fba47030cd8aad99dd8badbf172 @gabrielschulhof gabrielschulhof committed Jun 2, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 js/jquery.mobile.navigation.js
@@ -1070,6 +1070,12 @@ define( [
}
url = ( active.url || "" ) + dialogHashKey;
+
+ // tack on another dialogHashKey if this is the same as the initial hash
+ // this makes sure that a history entry is created for this dialog
+ if ( urlHistory.activeIndex === 0 && url === urlHistory.initialDst ) {
+ url += dialogHashKey;
+ }
}
// Set the location hash.
@@ -1395,14 +1401,18 @@ define( [
fromHashChange: true
};
+ if ( 0 === urlHistory.stack.length ) {
+ urlHistory.initialDst = to;
+ }
+
//if listening is disabled (either globally or temporarily), or it's a dialog hash
if( !$.mobile.hashListeningEnabled || urlHistory.ignoreNextHashChange ) {
urlHistory.ignoreNextHashChange = false;
return;
}
// special case for dialogs
- if( urlHistory.stack.length > 1 && to.indexOf( dialogHashKey ) > -1 ) {
+ if( urlHistory.stack.length > 1 && to.indexOf( dialogHashKey ) > -1 && urlHistory.initialDst !== to ) {
// If current active page is not a dialog skip the dialog and continue
// in the same direction

0 comments on commit d93c655

Please sign in to comment.