Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Fix click on Proceed to checkout bug when Coupon error is visible. #3996

Merged
merged 4 commits into from
Mar 31, 2021

Conversation

ralucaStan
Copy link
Contributor

@ralucaStan ralucaStan commented Mar 24, 2021

The bug happened because of the layout shift produced by the error message disappearance.

This PR adds an in-place fix for the Coupon code field. It adds an empty space equal to the space taken up by the error message.
If this becomes an issue for other parts of the project we will need to implement a project-wide sollution.

Fixes #3968

Screenshots

The ticket has the original behavior.

Screenshot 2021-03-24 at 15 45 21

Screenshot 2021-03-24 at 15 45 13

Changes seen here.

How to test the changes in this Pull Request:

Steps to reproduce the behavior:

Make sure you use the Cart block
Add any product to the cart and go to the Cart block.
Enter an invalid coupon code.
See coupon validation error appear
Click on the "Proceed to Checkout" button
Notice you are directed to the Checkout

Changelog

Fix the Proceed to checkout button click bug happening when the Coupon error is visible in the Cart block

@ralucaStan ralucaStan added status: needs review focus: blocks Specific work involving or impacting how blocks behave. block: cart Issues related to the cart block. labels Mar 24, 2021
@ralucaStan ralucaStan added this to the 4.8.0 milestone Mar 24, 2021
@ralucaStan ralucaStan self-assigned this Mar 24, 2021
@ralucaStan ralucaStan requested a review from a team as a code owner March 24, 2021 15:50
@ralucaStan ralucaStan requested review from mikejolley and removed request for a team March 24, 2021 15:50
@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2021

Size Change: -31 B (0%)

Total Size: 1.16 MB

Filename Size Change
build/style-rtl.css 18.4 kB -15 B (0%)
build/style.css 18.4 kB -16 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/active-filters-frontend.js 8.62 kB 0 B
build/active-filters.js 8.71 kB 0 B
build/all-products-frontend.js 35.1 kB 0 B
build/all-products.js 37 kB 0 B
build/all-reviews.js 9.91 kB 0 B
build/atomic-block-components/add-to-cart--atomic-block-components/button-frontend.js 1.97 kB 0 B
build/atomic-block-components/add-to-cart--atomic-block-components/button.js 3.59 kB 0 B
build/atomic-block-components/add-to-cart--atomic-block-components/image--atomic-block-components/title.js 336 B 0 B
build/atomic-block-components/add-to-cart-frontend.js 8.09 kB 0 B
build/atomic-block-components/add-to-cart.js 7.74 kB 0 B
build/atomic-block-components/button-frontend.js 1.04 kB 0 B
build/atomic-block-components/button.js 1.05 kB 0 B
build/atomic-block-components/category-list-frontend.js 470 B 0 B
build/atomic-block-components/category-list.js 476 B 0 B
build/atomic-block-components/image-frontend.js 1.77 kB 0 B
build/atomic-block-components/image.js 1.24 kB 0 B
build/atomic-block-components/price-frontend.js 1.98 kB 0 B
build/atomic-block-components/price.js 2 kB 0 B
build/atomic-block-components/rating-frontend.js 520 B 0 B
build/atomic-block-components/rating.js 525 B 0 B
build/atomic-block-components/sale-badge-frontend.js 861 B 0 B
build/atomic-block-components/sale-badge.js 871 B 0 B
build/atomic-block-components/sku-frontend.js 391 B 0 B
build/atomic-block-components/sku.js 394 B 0 B
build/atomic-block-components/stock-indicator-frontend.js 569 B 0 B
build/atomic-block-components/stock-indicator.js 573 B 0 B
build/atomic-block-components/summary-frontend.js 922 B 0 B
build/atomic-block-components/summary.js 924 B 0 B
build/atomic-block-components/tag-list-frontend.js 467 B 0 B
build/atomic-block-components/tag-list.js 473 B 0 B
build/atomic-block-components/title-frontend.js 1.35 kB 0 B
build/atomic-block-components/title.js 1.21 kB 0 B
build/attribute-filter-frontend.js 18.4 kB 0 B
build/attribute-filter.js 12.5 kB 0 B
build/blocks-checkout.js 17 kB 0 B
build/blocks.js 3.5 kB 0 B
build/cart-frontend.js 76.5 kB 0 B
build/cart.js 42.5 kB 0 B
build/checkout-frontend.js 81.1 kB 0 B
build/checkout.js 44.9 kB 0 B
build/editor-rtl.css 14.9 kB 0 B
build/editor.css 14.9 kB 0 B
build/featured-category.js 7.86 kB 0 B
build/featured-product.js 10.1 kB 0 B
build/handpicked-products.js 7.54 kB 0 B
build/price-filter-frontend.js 14.7 kB 0 B
build/price-filter.js 10 kB 0 B
build/price-format.js 1.46 kB 0 B
build/product-best-sellers.js 7.61 kB 0 B
build/product-categories.js 3.23 kB 0 B
build/product-category.js 8.56 kB 0 B
build/product-new.js 7.78 kB 0 B
build/product-on-sale.js 8.18 kB 0 B
build/product-search.js 3.61 kB 0 B
build/product-tag.js 6.61 kB 0 B
build/product-top-rated.js 7.75 kB 0 B
build/products-by-attribute.js 8.54 kB 0 B
build/reviews-by-category.js 12 kB 0 B
build/reviews-by-product.js 13.5 kB 0 B
build/reviews-frontend.js 9.59 kB 0 B
build/single-product-frontend.js 38.1 kB 0 B
build/single-product.js 10.3 kB 0 B
build/vendors--atomic-block-components/price-frontend.js 6.54 kB 0 B
build/vendors-style-rtl.css 1.05 kB 0 B
build/vendors-style.css 1.05 kB 0 B
build/vendors.js 419 kB 0 B
build/wc-blocks-data.js 7.35 kB 0 B
build/wc-blocks-google-analytics.js 1.35 kB 0 B
build/wc-blocks-middleware.js 1.32 kB 0 B
build/wc-blocks-registry.js 2.74 kB 0 B
build/wc-payment-method-bacs.js 812 B 0 B
build/wc-payment-method-cheque.js 807 B 0 B
build/wc-payment-method-cod.js 903 B 0 B
build/wc-payment-method-paypal.js 844 B 0 B
build/wc-payment-method-stripe.js 12.3 kB 0 B
build/wc-settings.js 2.43 kB 0 B
build/wc-shared-context.js 1.53 kB 0 B
build/wc-shared-hocs.js 1.72 kB 0 B

compressed-size-action

@mikejolley
Copy link
Member

Just making a note that I suggested an alternative to empty elements in using e.preventDefault on the place order button click.

If thats not viable, another thing we could consider is making the notice only dismiss after re-entry to the coupon field rather than on blur.

@ralucaStan
Copy link
Contributor Author

While testing your proposal I noticed that the coupon is actually the only with an error that has a layout shift. All the other inputs in cart & checkout don't have it. So for consistency's sake and for a clean solution I will try to implement the same behaviour for the coupon input
Screenshot 2021-03-26 at 13 47 56
In checkout
Screenshot 2021-03-26 at 13 47 06

@ralucaStan
Copy link
Contributor Author

Fixed this by making sure the validation error looks & feels like other validations in the checkout & cart forms. I had to add a small space on the bottom (just CSS) because all the input fields need 1.5em space under them.

@ralucaStan
Copy link
Contributor Author

@mikejolley ready for review

Copy link
Member

@mikejolley mikejolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving this on the basis that it solves the issue and matches the fields on checkout. I think these could use some work in the future though, the styling doesn't seem great—it's cramped and would break with longer messages I expect.

👍🏻

@ralucaStan ralucaStan force-pushed the fix/3968-coupon-field-error branch from 3ea77c9 to 26b7013 Compare March 31, 2021 09:33
@ralucaStan ralucaStan merged commit 3ff4774 into trunk Mar 31, 2021
@ralucaStan ralucaStan deleted the fix/3968-coupon-field-error branch March 31, 2021 09:50
@ralucaStan ralucaStan added the type: bug The issue/PR concerns a confirmed bug. label Mar 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: cart Issues related to the cart block. focus: blocks Specific work involving or impacting how blocks behave. type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proceed to checkout button does not work if pressed when there is a coupon validation error
2 participants