Skip to content

Commit

Permalink
fix(storefront): BCTHEME-544 fix potential shift on change options mo…
Browse files Browse the repository at this point in the history
…dal on Cart
  • Loading branch information
bc-alexsaiannyi committed Jun 8, 2021
1 parent 64348b2 commit 6a048ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Fixed shift in change options popup on Cart page.[#2071](https://github.com/bigcommerce/cornerstone/pull/2071)
- Translation Gap: Compare products error message. [#2061](https://github.com/bigcommerce/cornerstone/pull/2061)
- Translation Gap: Gift Certificate -> Code required message. [#2064](https://github.com/bigcommerce/cornerstone/pull/2064)
- Added translation for invalid quantity value error on Cart. [#2062](https://github.com/bigcommerce/cornerstone/pull/2062)
Expand Down
15 changes: 11 additions & 4 deletions assets/js/theme/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import checkIsGiftCertValid from './common/gift-certificate-validator';
import { createTranslationDictionary } from './common/utils/translations-utils';
import utils from '@bigcommerce/stencil-utils';
import ShippingEstimator from './cart/shipping-estimator';
import { defaultModal } from './global/modal';
import { defaultModal, ModalEvents } from './global/modal';
import swal from './global/sweet-alert';
import CartItemDetails from './common/cart-item-details';

Expand Down Expand Up @@ -147,6 +147,15 @@ export default class Cart extends PageManager {

if (this.$modal === null) {
this.$modal = $('#modal');

this.$modal.on(ModalEvents.opened, () => {
const $productOptionsContainer = $('[data-product-attributes-wrapper]', this.$modal);
const modalBodyReservedHeight = $productOptionsContainer.outerHeight();

if (modalBodyReservedHeight) {
$productOptionsContainer.css('height', modalBodyReservedHeight);
}
});
}

const options = {
Expand All @@ -158,9 +167,7 @@ export default class Cart extends PageManager {

utils.api.productAttributes.configureInCart(itemId, options, (err, response) => {
modal.updateContent(response.content);
const $productOptionsContainer = $('[data-product-attributes-wrapper]', this.$modal);
const modalBodyReservedHeight = $productOptionsContainer.outerHeight();
$productOptionsContainer.css('height', modalBodyReservedHeight);
this.$modal.triggerHandler(ModalEvents.opened);

this.productDetails = new CartItemDetails(this.$modal, context);

Expand Down

0 comments on commit 6a048ba

Please sign in to comment.