From 8ee43189aeea929ba1765aa32a655472af32e47a Mon Sep 17 00:00:00 2001 From: John Bender Date: Tue, 27 Nov 2012 15:57:08 -0800 Subject: [PATCH] prevent dialogs re-using initial ui state from going back --- js/widgets/dialog.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/widgets/dialog.js b/js/widgets/dialog.js index d63419c0a76..b6a01ceb258 100644 --- a/js/widgets/dialog.js +++ b/js/widgets/dialog.js @@ -88,7 +88,10 @@ $.widget( "mobile.dialog", $.mobile.widget, { if ( this._isCloseable ) { this._isCloseable = false; - if ( $.mobile.hashListeningEnabled ) { + // If the hash listening is enabled and there is at least one preceding history + // entry it's ok to go back. Initial pages with the dialog hash state are an example + // where the stack check is necessary + if ( $.mobile.hashListeningEnabled && $.mobile.urlHistory.stack.length > 1 ) { $.mobile.back(); } else { dst = $.mobile.urlHistory.getActive().url;