Skip to content

Commit a9a51f6

Browse files
authored
Merge pull request #2423 from magento-tango/MAGETWO-73537
MAGETWO-73537 Browser back button issue (Checkout pages)
2 parents 7d636a4 + 78f8094 commit a9a51f6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/step-navigator.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ define([
182182
});
183183
},
184184

185+
/**
186+
* Sets window location hash.
187+
*
188+
* @param {String} hash
189+
*/
190+
setHash: function (hash) {
191+
window.location.hash = hash;
192+
},
193+
185194
/**
186195
* Next step.
187196
*/
@@ -199,7 +208,7 @@ define([
199208
if (steps().length > activeIndex + 1) {
200209
code = steps()[activeIndex + 1].code;
201210
steps()[activeIndex + 1].isVisible(true);
202-
window.location = window.checkoutConfig.checkoutUrl + '#' + code;
211+
this.setHash(code);
203212
document.body.scrollTop = document.documentElement.scrollTop = 0;
204213
}
205214
}

app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ define([
2626
initialize: function () {
2727
this._super();
2828
$(window).hashchange(_.bind(stepNavigator.handleHash, stepNavigator));
29+
30+
if (!window.location.hash) {
31+
stepNavigator.setHash(stepNavigator.steps().sort(stepNavigator.sortItems)[0].code);
32+
}
33+
2934
stepNavigator.handleHash();
3035
},
3136

0 commit comments

Comments
 (0)