From 2dcd0f888748120308a3008849badd574a5356c7 Mon Sep 17 00:00:00 2001 From: Yurii Zusik Date: Thu, 12 Nov 2020 11:43:55 +0200 Subject: [PATCH] fix(storefront): BCTHEME-319 Write a review modal extra executions --- CHANGELOG.md | 1 + assets/js/theme/product.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c4df70c13..8295e2afdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Draft +- Write a review modal extra executions. [#1902](https://github.com/bigcommerce/cornerstone/pull/1902) ## 4.12.1 (11-10-2020) - Write a Review modal cause TypeError. [#1899](https://github.com/bigcommerce/cornerstone/pull/1899) diff --git a/assets/js/theme/product.js b/assets/js/theme/product.js index 0c4c20020f..8474a425ee 100644 --- a/assets/js/theme/product.js +++ b/assets/js/theme/product.js @@ -46,7 +46,11 @@ export default class Product extends PageManager { const review = new Review($reviewForm); - $(document).on('opened.fndtn.reveal', () => this.reviewModal.setupFocusableElements(WRITE_REVIEW)); + $(document).on('opened.fndtn.reveal', (event) => { + if ($(event.target).attr('id') === 'modal-review-form') { + this.reviewModal.setupFocusableElements(WRITE_REVIEW); + }; + }); $('body').on('click', '[data-reveal-id="modal-review-form"]', () => { validator = review.registerValidation(this.context);