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

Update Cart & Checkout heading styles #2597

Merged
merged 12 commits into from Jun 5, 2020
Merged

Conversation

Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Jun 1, 2020

Fixes #2562.
Closes #2141.
Closes #2142.
Part of #2459.
Part of #2605.

This PR:

  • Removes all hard-coded colors, font weight, font family, etc. from headings. So they are inherited from the theme.
  • I replaced the <Panel> component from Gutenberg with a custom one. Panel had some issues:
    • It was forcing the button to be an <h2>, that was not semantically correct because in some cases it needed to be an <h3> (shipping packages, for example).
    • Its styles were really influenced by their presence in the editor and it had some hard-coded colors. Resetting them in the frontend was getting harder and harder.
  • I removed the <Card> component following to the designs in: pbIy4N-dY-p2.

Accessibility

  • I've tested using only a keyboard (no mouse)
  • I've tested using a screen reader

Screenshots

Cart:
imatge

Checkout:
imatge

How to test the changes in this Pull Request:

  1. In Storefront, go to Appearance > Customize and change the Heading color.
  2. Visit the Cart and Checkout blocks and verify the heading color is applied to the headings.
  3. Verify there are no regressions related to the PanelDisclosureWidget change. Click on the Order Summary title, the Coupon?, etc.
  4. Verify the Cart and Checkout blocks don't have Cards in the sidebar.
  5. Feel free to try with other themes and verify the heading styles are correctly applied to the blocks.

Changelog

The Cart and Checkout blocks now use the heading styles provided by the theme.

@Aljullu Aljullu added the focus: components Work that introduces new or updates existing components. label Jun 1, 2020
@Aljullu Aljullu added this to the 2.7.0 milestone Jun 1, 2020
@Aljullu Aljullu self-assigned this Jun 1, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2020

Size Change: -52.3 kB (3%)

Total Size: 1.73 MB

Filename Size Change
build/active-filters-frontend.js 7.26 kB -1 B
build/all-products-frontend.js 71.9 kB -15 B (0%)
build/all-products.js 15.7 kB -3 B (0%)
build/all-reviews.js 9.46 kB +1 B
build/attribute-filter-frontend.js 16.7 kB -6 B (0%)
build/attribute-filter.js 11.5 kB +4 B (0%)
build/block-error-boundary-legacy.js 775 B +1 B
build/block-error-boundary.js 774 B -1 B
build/cart-frontend.js 97.4 kB -15.7 kB (16%) 👏
build/cart.js 32.7 kB +404 B (1%)
build/checkout-frontend.js 114 kB -15.6 kB (13%) 👏
build/checkout.js 38 kB +139 B (0%)
build/featured-category-legacy.js 7.26 kB +1 B
build/featured-category.js 7.53 kB -2 B (0%)
build/featured-product-legacy.js 9.5 kB -1 B
build/featured-product.js 9.79 kB -2 B (0%)
build/handpicked-products.js 7.17 kB -1 B
build/panel-style-legacy.js 0 B -773 B (0%)
build/panel-style.js 0 B -773 B (0%)
build/price-filter-frontend.js 13.9 kB -273 B (1%)
build/price-filter.js 9.98 kB +6 B (0%)
build/product-best-sellers-legacy.js 6.98 kB +1 B
build/product-best-sellers.js 7.25 kB +4 B (0%)
build/product-categories-legacy.js 3.22 kB -1 B
build/product-categories.js 3.21 kB +2 B (0%)
build/product-category.js 8.15 kB +5 B (0%)
build/product-new-legacy.js 7.13 kB +2 B (0%)
build/product-new.js 7.41 kB +6 B (0%)
build/product-on-sale-legacy.js 7.51 kB +1 B
build/product-on-sale.js 7.8 kB +1 B
build/product-search-legacy.js 3.12 kB +1 B
build/product-search.js 3.37 kB +4 B (0%)
build/product-tag.js 6.33 kB +2 B (0%)
build/product-top-rated-legacy.js 7.11 kB +1 B
build/product-top-rated.js 7.38 kB +5 B (0%)
build/products-by-attribute.js 8.13 kB -1 B
build/reviews-by-category-legacy.js 11.2 kB +1 B
build/reviews-by-category.js 11.5 kB -1 B
build/reviews-by-product-legacy.js 12.7 kB -1 B
build/reviews-by-product.js 13 kB -6 B (0%)
build/reviews-frontend.js 8.95 kB -4 B (0%)
build/single-product-frontend.js 58.8 kB -46 B (0%)
build/single-product.js 14.2 kB -5 B (0%)
build/snackbar-notice-style.js 779 B +1 B
build/spinner-style-legacy.js 772 B -3 B (0%)
build/spinner-style.js 771 B -1 B
build/style-legacy-rtl.css 5.6 kB -2 B (0%)
build/style-legacy.css 5.61 kB -1 B
build/style-rtl.css 16.4 kB -152 B (0%)
build/style.css 16.4 kB -158 B (0%)
build/vendors-legacy.js 376 kB -1 B
build/vendors-style-legacy-rtl.css 1.03 kB -610 B (58%) 🏆
build/vendors-style-legacy.css 1.03 kB -612 B (59%) 🏆
build/vendors-style-legacy.js 102 B -3 B (2%)
build/vendors-style-rtl.css 1.03 kB -610 B (58%) 🏆
build/vendors-style.css 1.03 kB -612 B (59%) 🏆
build/vendors-style.js 102 B -3 B (2%)
build/vendors.js 456 kB -16.9 kB (3%)
ℹ️ View Unchanged
Filename Size Change
build/active-filters.js 7.89 kB 0 B
build/all-reviews-legacy.js 9.19 kB 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/handpicked-products-legacy.js 6.9 kB 0 B
build/product-category-legacy.js 7.89 kB 0 B
build/product-list-style-legacy.js 775 B 0 B
build/product-tag-legacy.js 6.07 kB 0 B
build/products-by-attribute-legacy.js 7.87 kB 0 B
build/reviews-frontend-legacy.js 8.03 kB 0 B
build/snackbar-notice-style-legacy.js 778 B 0 B
build/wc-blocks-data.js 7.08 kB 0 B
build/wc-blocks-middleware.js 932 B 0 B
build/wc-blocks-registry.js 1.78 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.17 kB 0 B

compressed-size-action

@senadir
Copy link
Member

senadir commented Jun 1, 2020

Nice seeing some weight improvements, also closes #2142

@Aljullu Aljullu marked this pull request as ready for review June 2, 2020 08:54
@Aljullu Aljullu requested a review from a team as a code owner June 2, 2020 08:54
@Aljullu Aljullu requested review from nerrad and removed request for a team June 2, 2020 08:54
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.

In general the changes seem okay Albert. I do have a comment regarding the naming of the new component that I wonder about.

Also I noticed the following when testing (I'm testing on Storefront 2.5.7RC1 and this branch):

Image 2020-06-02 at 2 51 32 PM

In the above screenshot, the focus border on the coupon panel is overlapped by the contents of the panel when opened. Not sure if this is intended or not, but looks weird.

In the following two screenshots (one desktop, and one mobile) I'm intending to illustrate the size of the titles (eg "Shopping Cart" and "2 items"). The weight of these titles doesn't seem to be that distinctive from the other content in the cart/checkout. Is that intentional? Also, even though they are h2's they don't seem to be inheriting from h2 styles in the theme (again, intentional?)

Image 2020-06-02 at 2 57 02 PM

Image 2020-06-02 at 3 16 21 PM

Since much of this pull is related to design, I wonder if we should also get @LevinMedia 's feedback on it as well?

*/
import './style.scss';

const DisclosureWidget = ( {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure on the name of this component. Disclosure connotes something privacy or terms and conditions related, and Widget suggests a generic action tool.

Maybe InformationPanel or DescriptionPanel? Or even just Panel (while realizing the potential confusion with the WordPress component, I think if we're dropping usage of that anyways, this shouldn't be that much of an issue).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Renamed to Panel in 92be5de.

@Aljullu
Copy link
Contributor Author

Aljullu commented Jun 3, 2020

Thanks for the review @nerrad!

In the above screenshot, the focus border on the coupon panel is overlapped by the contents of the panel when opened. Not sure if this is intended or not, but looks weird.

Good catch! I made the button clickable area a bit smaller in 48ace85. I think the target area is still large enough so a11y is not affected and visually it looks better:

Peek 2020-06-03 12-31

In the following two screenshots (one desktop, and one mobile) I'm intending to illustrate the size of the titles (eg "Shopping Cart" and "2 items"). The weight of these titles doesn't seem to be that distinctive from the other content in the cart/checkout. Is that intentional?

I think that's what we want per-design (tagging @LevinMedia in case he has some more feedback). The goal is to inherit all heading styles and only override the font-size. That means that in Storefront the titles have a light font weight.

If necessary, we could add some styles in Storefront targeting specially these titles so they have a bolder font weight. In parallel, we could add some docs for 3rd-party themes that want to do the same.

Also, even though they are h2's they don't seem to be inheriting from h2 styles in the theme (again, intentional?)

They should inherit everything except for the size. Is there any other style they are not inheriting?

@nerrad
Copy link
Contributor

nerrad commented Jun 3, 2020

They should inherit everything except for the size.

Ahh, I missed that, in that case it appears to be working as expected. Let's wait for feedback from @LevinMedia on the other questions (in case there are any changes) and then I'll do the final review/run through.

Copy link
Member

@senadir senadir 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 seeing weird styling in 2020
Screen Shot 2020-06-03 at 12 11 45 PM

storefront font-weight leaked into this, but I guess that was the goal?
image

@Aljullu
Copy link
Contributor Author

Aljullu commented Jun 3, 2020

Thanks for testing this too @senadir. However, I'm unable to reproduce. This is how it looks for me with 2020:

imatge

@senadir
Copy link
Member

senadir commented Jun 3, 2020

It works fine in small width but is broken on larger width

@Aljullu
Copy link
Contributor Author

Aljullu commented Jun 3, 2020

I'm still unable to reproduce. What do you mean by larger width? I tried the Full Width Template and it looks fine:
imatge

@nerrad
Copy link
Contributor

nerrad commented Jun 3, 2020

Thanks for checking more themes Nadir! I also notice some issues with Twenty Twenty (Chrome on Mac):

The following appears on both the default template width and the full-width template:

Image 2020-06-03 at 9 45 27 AM

The following appears in the editor:

Image 2020-06-03 at 9 46 00 AM

Also, even with full-width template selected for twenty-twenty, the checkout is constrained to the mobile view in the editor (might have to do with the container width in the editor? Or potentially a bug with twenty-twenty).

I tested with the latest twenty-twenty theme.

@nerrad
Copy link
Contributor

nerrad commented Jun 3, 2020

The latest issues make me wonder if we should settle on a common set of themes we test styles against as a part of this work to ensure we're not introducing potentially worse behaviour with changes? I fully realize getting things working well across all themes is going to be hard (and in some cases, simply impossible) but if we have a common sampling of various theme variations that can be used for the testing, it could help improve for most themes.

Also, we should consider looking into automating some visual regression testing against whatever theme sampling we decide on (might be good for a cooldown). Since so much of what we are stepping is affected by themes and frontend styles, I think it will be helpful for us to automate this as a part of our transitory work between old styles and eventual Global Styles/block themes.

@senadir
Copy link
Member

senadir commented Jun 3, 2020

Okay so this is an edge case as far as I see, if I insert the block alone directly, it won’t show, if I have the block inside a column (my initial setup), it will look like this

image

tested on master and it also existed there, so not blocking

@senadir
Copy link
Member

senadir commented Jun 3, 2020

Also, we should consider looking into automating some visual regression testing against whatever theme sampling we decide on (might be good for a cooldown). Since so much of what we are stepping is affected by themes and frontend styles, I think it will be helpful for us to automate this as a part of our transitory work between old styles and eventual Global Styles/block themes.

on an individual basis, our components works fine for the most time, the issues we run into is other themes styles leaking into ours, we can look into automating this in storefront and see how things work out.

@Aljullu
Copy link
Contributor Author

Aljullu commented Jun 3, 2020

The following appears on both the default template width and the full-width template:

Oh, right. Express shipping methods don't appear by default in my local install and I missed it. 🤦

The following appears in the editor:

I think this was also happening in master, but this PR is a good opportunity to fix it: 3995214.

Okay so this is an edge case as far as I see, if I insert the block alone directly, it won’t show, if I have the block inside a column (my initial setup), it will look like this

Ah, good catch! Should be fixed in the same commit. Twenty Twenty seems to add selectors with a very high specificity and that was not playing well with our blocks.

Also, even with full-width template selected for twenty-twenty, the checkout is constrained to the mobile view in the editor (might have to do with the container width in the editor? Or potentially a bug with twenty-twenty).

My guess is that this is an issue with TwentyTwenty. Ideally, the editor available space should change depending on the select template (this is how it works with Storefront). I created an issue in Trac: https://core.trac.wordpress.org/ticket/50311.

Also, we should consider looking into automating some visual regression testing against whatever theme sampling we decide on (might be good for a cooldown). Since so much of what we are stepping is affected by themes and frontend styles, I think it will be helpful for us to automate this as a part of our transitory work between old styles and eventual Global Styles/block themes.

💯

on an individual basis, our components works fine for the most time, the issues we run into is other themes styles leaking into ours, we can look into automating this in storefront and see how things work out.

I think @nerrad's point (or at least what I understood 😄 ) was to have an automated tool to report changes in a set of themes. Most of us are usually in Storefront so it's easy to spot regressions there, but a regression in another theme might pass inadvertently (like the Express Checkout title being mispositioned in this PR).

@nerrad
Copy link
Contributor

nerrad commented Jun 3, 2020

I think @nerrad's point (or at least what I understood 😄 ) was to have an automated tool to report changes in a set of themes.

That 👍

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.

Thanks Albert for the changes, looks much better in Twenty Twenty now. I'm going to pre-approve this but I still think we should get feedback from @LevinMedia before it's merged. Since I'm not sure he's seen this you might want to ping him directly in slack to make sure he's aware.

@LevinMedia
Copy link
Contributor

Also, even with full-width template selected for twenty-twenty, the checkout is constrained to the mobile view in the editor (might have to do with the container width in the editor? Or potentially a bug with twenty-twenty).

@nerrad I've noticed this behavior on a number of themes... and even on themes that do allow for the full width of the cart and checkout on desktop, sometimes they get positioned off to the side in a strange way.

It's been discussed previously in slack with @senadir and @haszari - but I feel like this is a great case for introducing some kind of control that breaks the blocks out of the theme template, and forces them into a width and pattern of responsive behavior that we have complete control over.

@LevinMedia
Copy link
Contributor

LevinMedia commented Jun 4, 2020

The weight of these titles doesn't seem to be that distinctive from the other content in the cart/checkout. Is that intentional?

@nerrad as @Aljullu yes this is intentional... it's highly subjective to what the theme prescribes as a heading style. Here are a few examples:

Storefront:
screencapture-ephemeral-levinmedia-20200603-atomicsites-blog-checkout-2020-06-04-08_49_09

Galleria
screencapture-ephemeral-levinmedia-20200603-atomicsites-blog-checkout-2020-06-04-08_31_54

Interesting to note the right column headings didn't pick up the styles correctly 🧐

Envo
screencapture-ephemeral-levinmedia-20200603-atomicsites-blog-checkout-2020-06-04-08_17_24

Astra
screencapture-ephemeral-levinmedia-20200603-atomicsites-blog-checkout-2020-06-04-08_27_51

You can see, in some cases it's great, and others it's not that rad. I think in general though it should be up to a theme to provide heading styles that contrast reasonably with body copy.

All that said - @Aljullu can you bump up the font size from default to large on all headings i think that's going to help without being overwhelming. This would also have to be updated in the cart to match.

@nerrad
Copy link
Contributor

nerrad commented Jun 4, 2020

All that said - @Aljullu can you bump up the font size from default to large on all headings i think that's going to help without being overwhelming. This would also have to be updated in the cart to match.

I think even that bump will help significantly as it will help distinguish it a bit more from the rest of the content imo.

@Aljullu
Copy link
Contributor Author

Aljullu commented Jun 5, 2020

Interesting to note the right column headings didn't pick up the styles correctly 🧐

Ah, good catch. We weren't resetting the italics added by the <button> element, that has been fixed in ef99c02. In the other hand, Galleria seems to force the font weight to light with an !important rule, so I don't think that's something we want to fix on our end. Should we open an issue in their repo?

All that said - @Aljullu can you bump up the font size from default to large on all headings i think that's going to help without being overwhelming. This would also have to be updated in the cart to match.

Done in 11c856b. It includes some small tweaks that were needed to make sure everything still aligned with the new heading size.

Lastly, I also pushed a commit adding padding to the address form and Shipping options in the Cart block, so they align with the rest of the column:

Before After
imatge imatge

@Aljullu Aljullu merged commit a162c54 into master Jun 5, 2020
@Aljullu Aljullu deleted the update/checkout-headings branch June 5, 2020 10:00
Aljullu added a commit that referenced this pull request Jun 8, 2020
* Move order summary styles to component style.scss

* Fix wrong class name in Order summary

* Move express payment methods a little bit higher

* Fix shipping options panel misaligned in the Cart sidebar

* Add right padding to panel button so text doesn't overlap the arrow

* Fix wrong class name in Order summary (II)
@Aljullu Aljullu added the type: enhancement The issue is a request for an enhancement. label Jun 8, 2020
@Aljullu Aljullu mentioned this pull request Jun 8, 2020
11 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: components Work that introduces new or updates existing components. type: enhancement The issue is a request for an enhancement.
Projects
None yet
5 participants