Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storefront): BCTHEME-315 Write a Review modal cause TypeError #1899

Merged
merged 2 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Write a Review modal cause TypeError. [#1899](https://github.com/bigcommerce/cornerstone/pull/1899)
- Account >Payment Methods throws Server Error when using Cornerstone theme [#1898](https://github.com/bigcommerce/cornerstone/pull/1898)
- Price in the cart is not updated when changing currency on mobile. [#1893](https://github.com/bigcommerce/cornerstone/pull/1893)

Expand Down
10 changes: 7 additions & 3 deletions assets/js/theme/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export default class Product extends PageManager {
}
});

$(document).on('opened.fndtn.reveal', () => this.reviewModal.setupFocusableElements(WRITE_REVIEW));

let validator;

// Init collapsible
Expand All @@ -40,9 +38,16 @@ export default class Product extends PageManager {

videoGallery();

this.bulkPricingHandler();

const $reviewForm = classifyForm('.writeReview-form');

if ($reviewForm.length === 0) return;

const review = new Review($reviewForm);

$(document).on('opened.fndtn.reveal', () => this.reviewModal.setupFocusableElements(WRITE_REVIEW));

$('body').on('click', '[data-reveal-id="modal-review-form"]', () => {
validator = review.registerValidation(this.context);
this.ariaDescribeReviewInputs($reviewForm);
Expand All @@ -58,7 +63,6 @@ export default class Product extends PageManager {
});

this.productReviewHandler();
this.bulkPricingHandler();
}

ariaDescribeReviewInputs($form) {
Expand Down