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

Remove background color from Express Checkout title #2704

Merged
merged 3 commits into from Jun 15, 2020

Conversation

Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Jun 12, 2020

Fixes #2659.

Screenshots

Before:
imatge

After:
imatge

How to test the changes in this Pull Request:

  1. Change to a theme with a background color different from white or in the customizer change Storefront's background color to another one.
  2. Visit the Checkout page and verify that:
  • The Express checkout title doesn't have a background color different from the rest of the page and has left and right padding (so it doesn't collide with the border).
  • The Express checkout and Order summary titles are aligned.
  • The Express checkout box border is 1px wide, like in the new designs.

Changelog

Remove background color from Express checkout title.

@Aljullu Aljullu added status: needs review block: checkout Issues related to the checkout block. labels Jun 12, 2020
@Aljullu Aljullu added this to the 2.8.0 milestone Jun 12, 2020
@Aljullu Aljullu requested a review from a team as a code owner June 12, 2020 12:37
@Aljullu Aljullu self-assigned this Jun 12, 2020
@Aljullu Aljullu requested review from haszari and removed request for a team June 12, 2020 12:37
@github-actions
Copy link
Contributor

github-actions bot commented Jun 12, 2020

Size Change: +147 B (0%)

Total Size: 1.57 MB

Filename Size Change
build/all-products-frontend.js 38.9 kB -7 B (0%)
build/all-products.js 21.7 kB -8 B (0%)
build/cart-frontend.js 63.6 kB -12 B (0%)
build/cart.js 33 kB -11 B (0%)
build/checkout-frontend.js 80.2 kB -2 B (0%)
build/checkout.js 38.5 kB -1 B
build/single-product-frontend.js 41.7 kB -9 B (0%)
build/single-product.js 15.6 kB -9 B (0%)
build/style-rtl.css 17.4 kB +102 B (0%)
build/style.css 17.4 kB +104 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/active-filters-frontend.js 7.21 kB 0 B
build/active-filters.js 7.94 kB 0 B
build/all-reviews-legacy.js 9.24 kB 0 B
build/all-reviews.js 9.54 kB 0 B
build/attribute-filter-frontend.js 16.7 kB 0 B
build/attribute-filter.js 11.5 kB 0 B
build/block-error-boundary-legacy.js 775 B 0 B
build/block-error-boundary.js 774 B 0 B
build/blocks-legacy.js 2.92 kB 0 B
build/blocks.js 2.92 kB 0 B
build/custom-select-control-style-legacy.js 782 B 0 B
build/custom-select-control-style.js 782 B 0 B
build/editor-legacy-rtl.css 12.5 kB 0 B
build/editor-legacy.css 12.5 kB 0 B
build/editor-rtl.css 13.5 kB 0 B
build/editor.css 13.5 kB 0 B
build/featured-category-legacy.js 7.27 kB 0 B
build/featured-category.js 7.59 kB 0 B
build/featured-product-legacy.js 9.51 kB 0 B
build/featured-product.js 9.83 kB 0 B
build/handpicked-products-legacy.js 6.91 kB 0 B
build/handpicked-products.js 7.24 kB 0 B
build/price-filter-frontend.js 14.1 kB 0 B
build/price-filter.js 10 kB 0 B
build/product-best-sellers-legacy.js 6.99 kB 0 B
build/product-best-sellers.js 7.3 kB 0 B
build/product-categories-legacy.js 3.22 kB 0 B
build/product-categories.js 3.21 kB 0 B
build/product-category-legacy.js 7.91 kB 0 B
build/product-category.js 8.25 kB 0 B
build/product-list-style-legacy.js 774 B 0 B
build/product-new-legacy.js 7.15 kB 0 B
build/product-new.js 7.47 kB 0 B
build/product-on-sale-legacy.js 7.52 kB 0 B
build/product-on-sale.js 7.87 kB 0 B
build/product-search-legacy.js 3.14 kB 0 B
build/product-search.js 3.43 kB 0 B
build/product-tag-legacy.js 6.08 kB 0 B
build/product-tag.js 6.39 kB 0 B
build/product-top-rated-legacy.js 7.12 kB 0 B
build/product-top-rated.js 7.44 kB 0 B
build/products-by-attribute-legacy.js 7.88 kB 0 B
build/products-by-attribute.js 8.19 kB 0 B
build/reviews-by-category-legacy.js 11.2 kB 0 B
build/reviews-by-category.js 11.6 kB 0 B
build/reviews-by-product-legacy.js 12.7 kB 0 B
build/reviews-by-product.js 13.1 kB 0 B
build/reviews-frontend-legacy.js 8.08 kB 0 B
build/reviews-frontend.js 8.93 kB 0 B
build/snackbar-notice-style-legacy.js 778 B 0 B
build/snackbar-notice-style.js 779 B 0 B
build/spinner-style-legacy.js 772 B 0 B
build/spinner-style.js 772 B 0 B
build/style-legacy-rtl.css 5.5 kB 0 B
build/style-legacy.css 5.5 kB 0 B
build/vendors-legacy.js 366 kB 0 B
build/vendors-style-legacy-rtl.css 1.03 kB 0 B
build/vendors-style-legacy.css 1.03 kB 0 B
build/vendors-style-legacy.js 103 B 0 B
build/vendors-style-rtl.css 1.03 kB 0 B
build/vendors-style.css 1.03 kB 0 B
build/vendors-style.js 102 B 0 B
build/vendors.js 414 kB 0 B
build/wc-blocks-data.js 7.09 kB 0 B
build/wc-blocks-middleware.js 931 B 0 B
build/wc-blocks-registry.js 1.79 kB 0 B
build/wc-payment-method-cheque.js 794 B 0 B
build/wc-payment-method-paypal.js 830 B 0 B
build/wc-payment-method-stripe.js 11.9 kB 0 B
build/wc-settings.js 2.14 kB 0 B
build/wc-shared-context.js 1.51 kB 0 B

compressed-size-action

Comment on lines 35 to 42
margin-left: $gap-small;
pointer-events: none;
flex-grow: 1;
}
}

.wc-block-components-express-checkout__title {
flex-grow: 0;
padding-left: $gap-small;
padding-right: $gap-small;
Copy link
Contributor

@nerrad nerrad Jun 12, 2020

Choose a reason for hiding this comment

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

I can verify this change fixes the gap on the express checkout title:

Image 2020-06-12 at 3 42 43 PM

Super odd though that padding would not work. If this is a style loading issue, should we document this in an issue for further investigation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We had two selectors with the same specificity competing. The issue happened because depending on the build mode, stylesheets were loaded in a different order, so the styles applied where different.

If this is a style loading issue, should we document this in an issue for further investigation?

Created an issue: #2713.

Copy link
Contributor

@nerrad nerrad left a comment

Choose a reason for hiding this comment

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

I tested in Chrome and Safari and this looks good 👏

}

&::after {
border: $border-width solid transparent;
Copy link
Member

Choose a reason for hiding this comment

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

Are these pseudo elements used to create the "padding" around the title (i.e. overlay the other express payment border? Might be worth a little comment explaining the intention/approach, or maybe package as a mixin (or class) if that's practical.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Added a comment: 2b6f524. I don't think we need to create a mixin for it yet considering we are only using it here. We can extract it in the future if we see there are other instances where we use it.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the visual explanation below, ingenious fix!

Copy link
Member

@haszari haszari left a comment

Choose a reason for hiding this comment

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

I gave this a quick test & review - looking good.

Note I don't have any express payment methods configured, so I can't really test this.

It's tricky to get control of the whitespace around the heading when there is the express payment box behind! I'm keen to better understand the technique you've used :)

@Aljullu
Copy link
Contributor Author

Aljullu commented Jun 15, 2020

It's tricky to get control of the whitespace around the heading when there is the express payment box behind! I'm keen to better understand the technique you've used :)

@haszari Yeah, I wasn't even sure it was doable at all, but then I found a way. Basically the border is composed by the border of three elements:

  • The container: has left, bottom and right border (in the screenshot, the blue border). It can't have top border because it would appear behind the Express checkout title.
  • The title ::before pseudo-element: has left and top border (in the screenshot, the red border).
  • The title ::after pseudo-element: has right and top border (in the screenshot, the orange border).
    imatge

Hope this explanation makes sense. 🙂 The CSS solution was a bit tricky, but I don't think it will make it more difficult for themes, because border color is inherited from the text color, so it will change all at once.

@Aljullu Aljullu merged commit 19372eb into master Jun 15, 2020
@Aljullu Aljullu deleted the fix/2659-remove-express-checkout-background branch June 15, 2020 11:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: checkout Issues related to the checkout block.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Express checkout: title background is white even in themes with other background colors
4 participants