Back button should take you to the previous "page"
If you have clicked on options, will take you through the history of options you clicked on
Node: 7.10.0
NPM: 5.0.3
Meteor Node: 4.8.4
Meteor NPM: 4.6.1
Reaction CLI: 0.11.0
Reaction: 1.5.0
Reaction branch: marketplace
Docker: 17.06.0-ce
Add this to any of you external javascript files inside document.ready function
if (window.history && window.history.pushState) {
$(window).on('popstate', function() {
event.preventDefault();
var hashLocation = location.hash;
var hashSplit = hashLocation.split("#!/");
var hashName = hashSplit[1];
if(window.location.href.indexOf("/reaction/product/") >- 1){
if(document.getElementsByClassName('container container-main pdp-container').length > 0)
window.location.href = "/";
}
});
}
This issue remains. Adding more context.
Every time you click a variant, the URL is changed using a Router.go to change the URL.
Reaction.Router.go("product", {
handle: this.productHandle,
variantId: variant._id
}, {
as: Reaction.Router.getQueryParam("as")
});
This will cause the history to be updated and then click the back button seemingly does nothing, though it is selecting the previously selected variant.
Remove the Router.go calls from:
And verify that the URL param variantId, is not used in the PDP nor in the variant form. Instead you can use ReactionProduct.selectedVariant() if needed.
However, if you come to the page and the URL has a varaintId, it should still work as is. That is, if you click on the product from the cart, it will be a product URL with a varaintId, and the variant will be selected on the page.
Important
Should do this after https://github.com/reactioncommerce/reaction/pull/2893 , is merged as it removed the last remaining blaze from variant edit form.
@spencern this isn't a regression, not a marketplace blocker.
As this issue is not a regression for marketplace, I'm removing v1.5.0 tag.
Resolved by #3032
Resolved via #3032