diff --git a/CHANGELOG.md b/CHANGELOG.md index da1c7b7908..859a61d846 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Draft +- Added announcement on shipping estimator errors. [#1932](https://github.com/bigcommerce/cornerstone/pull/1932) - Add main tag on pages like Homepage, Category, Product etc to define the dominant content. [#1929](https://github.com/bigcommerce/cornerstone/pull/1929) - Fixed unable to change product quantity several times on cart page using keyboard. [#1927](https://github.com/bigcommerce/cornerstone/pull/1927) - Cornerstone - loading of thumbnail image delayed on cart page . [#1925](https://github.com/bigcommerce/cornerstone/pull/1925) diff --git a/assets/js/theme/cart/shipping-estimator.js b/assets/js/theme/cart/shipping-estimator.js index f3fc58b86a..6a30260f1d 100644 --- a/assets/js/theme/cart/shipping-estimator.js +++ b/assets/js/theme/cart/shipping-estimator.js @@ -17,12 +17,22 @@ export default class ShippingEstimator { } initFormValidation() { + const shippingEstimatorAlert = $('.shipping-quotes'); + this.shippingEstimator = 'form[data-shipping-estimator]'; this.shippingValidator = nod({ submit: `${this.shippingEstimator} .shipping-estimate-submit`, }); $('.shipping-estimate-submit', this.$element).on('click', event => { + // estimator error messages are being injected in html as a result + // of user submit; clearing and adding role on submit provides + // regular announcement of these error messages + if (shippingEstimatorAlert.attr('role')) { + shippingEstimatorAlert.removeAttr('role'); + } + + shippingEstimatorAlert.attr('role', 'alert'); // When switching between countries, the state/region is dynamic // Only perform a check for all fields when country has a value // Otherwise areAll('valid') will check country for validity diff --git a/templates/components/cart/shipping-estimator.html b/templates/components/cart/shipping-estimator.html index 382dfc2c8b..d07217747d 100644 --- a/templates/components/cart/shipping-estimator.html +++ b/templates/components/cart/shipping-estimator.html @@ -67,5 +67,5 @@ -
+