From a128b5ad43c4a6cded4a0ef8d2794720f473dec7 Mon Sep 17 00:00:00 2001 From: Youmin Ha Date: Mon, 8 Apr 2013 16:17:35 +0900 Subject: [PATCH] pagelayout: Remember back key when it is hidden If an app moves a page when the pop is shown, the .ui-page-active page is changed. In this case, the '.ui-page-active .ui-btn-back' selector indicates a new page's one, and the old page's .ui-btn-back button is still hidden. So, this patch remember the current back button, and show it again at the softkeyboardchange.off event. Resolves #N_SE-32900. Change-Id: I94fd641ca0e70b4093b881e2319c6f18a2b912a6 --- src/js/widgets/jquery.mobile.tizen.pagelayout.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/js/widgets/jquery.mobile.tizen.pagelayout.js b/src/js/widgets/jquery.mobile.tizen.pagelayout.js index 49bc11f..041dab3 100644 --- a/src/js/widgets/jquery.mobile.tizen.pagelayout.js +++ b/src/js/widgets/jquery.mobile.tizen.pagelayout.js @@ -102,6 +102,9 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) { // only content self._bindContentControlEvents(); + + // Store back-button, to show again + self._backBtnQueue = []; }, /* add minimum fixed css style to bar(header/footer) and content @@ -244,6 +247,7 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) { window.addEventListener( "softkeyboardchange", function ( e ) { var $elDownBtn = $( "" ), $elPage = $( ".ui-page-active" ), + backBtn, backBtnPosition = "footer"; if ( $elPage.data( "addBackBtn" ) ) { @@ -253,9 +257,22 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) { if ( !$elPage.find( ".ui-" + backBtnPosition + " .ui-btn-footer-down" ).length ) { $elDownBtn.buttonMarkup( { icon: "down" } ).appendTo( $elPage.find( ".ui-" + backBtnPosition ) ); } - $( ".ui-page-active .ui-btn-back" ).hide(); + + // N_SE-32900: If an app moves a page when the pop is shown, the .ui-page-active page + // is changed. + // In this case, the '.ui-page-active .ui-btn-back' selector indicates a + // new page's one, and the old page's .ui-btn-back button is still hidden. + // So, the current back button is remembered to be shown at the + // softkeyboardchange.off event. + backBtn = $( ".ui-page-active .ui-btn-back" ); + backBtn.hide(); + self._backBtnQueue.push( backBtn ); // Store hidden backBtn } else if ( e.state == "off" ) { - $( ".ui-page-active .ui-btn-back" ).show(); + self._backBtnQueue.forEach( function ( b ) { + b.show(); // Show each backBtn, + } ); + self._backBtnQueue.length = 0; // and clear queue. + $( ".ui-btn-footer-down" ).remove(); } } -- 2.7.4