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

Filter by Attribute block design updates #6920

Merged
merged 23 commits into from
Aug 25, 2022
Merged

Conversation

albarin
Copy link
Contributor

@albarin albarin commented Aug 18, 2022

Update the Filter by Attribute block UI to match the new designs.

Fixes #6843

Screenshots

Before After
Screenshot 2022-08-19 at 11 36 19 Screenshot 2022-08-19 at 11 35 10
Screenshot 2022-08-19 at 11 36 41 Screenshot 2022-08-19 at 11 37 15
Screenshot 2022-08-19 at 11 38 01 Screenshot 2022-08-19 at 11 37 28

Testing

Automated Tests

  • Changes in this PR are covered by Automated Tests.
    • Unit tests
    • E2E tests

User Facing Testing

  1. Add the Filter by Attribute block to a page.
  2. Check that it looks like the new design in the editor and the front-end.
  3. Check that the Reset button appears when a checkbox is checked.
  4. Edit the page and change the Display Style to dropdown.
  5. Check that it looks like the new design in the editor and the front-end (it won't look exactly like the design, check this conversation for more context)

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

Changelog

Update the design of the Filter Products by Attribute block.

@github-actions
Copy link
Contributor

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-6920.zip

@github-actions
Copy link
Contributor

github-actions bot commented Aug 18, 2022

Size Change: +1.14 kB (0%)

Total Size: 870 kB

Filename Size Change
build/active-filters-frontend.js 7.34 kB +1 B (0%)
build/active-filters.js 7.99 kB +1 B (0%)
build/all-products.js 33.7 kB -12 B (0%)
build/attribute-filter-frontend.js 22.1 kB +269 B (+1%)
build/attribute-filter.js 13.1 kB +210 B (+2%)
build/cart-blocks/cart-express-payment-frontend.js 5.09 kB -2 B (0%)
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.27 kB +1 B (0%)
build/cart-blocks/cart-line-items-frontend.js 429 B +1 B (0%)
build/cart-blocks/cart-order-summary-frontend.js 1.1 kB +1 B (0%)
build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js 6.37 kB -1 B (0%)
build/cart-blocks/order-summary-taxes-frontend.js 434 B +1 B (0%)
build/cart-frontend.js 47.1 kB +7 B (0%)
build/cart.js 41.3 kB -4 B (0%)
build/checkout-blocks/actions-frontend.js 1.42 kB -1 B (0%)
build/checkout-blocks/express-payment-frontend.js 5.38 kB -2 B (0%)
build/checkout-blocks/order-summary-cart-items-frontend.js 3.66 kB -2 B (0%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 2.8 kB +1 B (0%)
build/checkout-blocks/order-summary-frontend.js 1.11 kB +2 B (0%)
build/checkout-blocks/order-summary-taxes-frontend.js 434 B +1 B (0%)
build/checkout-blocks/payment-frontend.js 7.7 kB -1 B (0%)
build/checkout-blocks/shipping-address-frontend.js 1.03 kB +1 B (0%)
build/checkout-blocks/shipping-methods-frontend.js 4.75 kB +1 B (0%)
build/checkout-frontend.js 49.3 kB +16 B (0%)
build/featured-category.js 13.2 kB +2 B (0%)
build/featured-product.js 13.5 kB +1 B (0%)
build/mini-cart-component-frontend.js 16.8 kB +1 B (0%)
build/mini-cart-contents-block/footer-frontend.js 6.98 kB -1 B (0%)
build/price-filter-frontend.js 13.3 kB -73 B (-1%)
build/price-filter.js 9.16 kB -3 B (0%)
build/product-add-to-cart--product-button--product-image--product-title.js 2.65 kB -3 B (0%)
build/product-add-to-cart.js 6.88 kB -4 B (0%)
build/product-button-frontend.js 1.88 kB +2 B (0%)
build/product-image-frontend.js 1.89 kB +3 B (0%)
build/product-price-frontend.js 1.9 kB +1 B (0%)
build/product-price.js 1.51 kB +1 B (0%)
build/product-sale-badge-frontend.js 1.13 kB +1 B (0%)
build/product-sale-badge.js 803 B -1 B (0%)
build/product-search.js 2.64 kB -1 B (0%)
build/product-summary-frontend.js 1.29 kB +1 B (0%)
build/product-title.js 921 B -1 B (0%)
build/reviews-by-category.js 11.2 kB +2 B (0%)
build/reviews-by-product.js 12.3 kB +2 B (0%)
build/reviews-frontend.js 7.01 kB -3 B (0%)
build/single-product-frontend.js 21.4 kB -2 B (0%)
build/single-product.js 10 kB -8 B (0%)
build/stock-filter-frontend.js 7.5 kB -13 B (0%)
build/stock-filter.js 7.46 kB -2 B (0%)
build/wc-blocks-style-rtl.css 22.8 kB +372 B (+2%)
build/wc-blocks-style.css 22.8 kB +369 B (+2%)
build/wc-blocks-vendors.js 54.5 kB +7 B (0%)
ℹ️ View Unchanged
Filename Size
build/all-products-frontend.js 18.1 kB
build/all-reviews.js 7.79 kB
build/blocks-checkout.js 17.4 kB
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.16 kB
build/cart-blocks/cart-items-frontend.js 299 B
build/cart-blocks/cart-totals-frontend.js 321 B
build/cart-blocks/empty-cart-frontend.js 346 B
build/cart-blocks/filled-cart-frontend.js 781 B
build/cart-blocks/order-summary-coupon-form-frontend.js 2.65 kB
build/cart-blocks/order-summary-discount-frontend.js 2.15 kB
build/cart-blocks/order-summary-fee-frontend.js 274 B
build/cart-blocks/order-summary-heading-frontend.js 454 B
build/cart-blocks/order-summary-shipping-frontend.js 426 B
build/cart-blocks/order-summary-subtotal-frontend.js 274 B
build/cart-blocks/proceed-to-checkout-frontend.js 1.15 kB
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 4.12 kB
build/checkout-blocks/billing-address-frontend.js 891 B
build/checkout-blocks/contact-information-frontend.js 2.83 kB
build/checkout-blocks/fields-frontend.js 345 B
build/checkout-blocks/order-note-frontend.js 1.07 kB
build/checkout-blocks/order-summary-discount-frontend.js 2.26 kB
build/checkout-blocks/order-summary-fee-frontend.js 276 B
build/checkout-blocks/order-summary-shipping-frontend.js 604 B
build/checkout-blocks/order-summary-subtotal-frontend.js 274 B
build/checkout-blocks/terms-frontend.js 1.23 kB
build/checkout-blocks/totals-frontend.js 325 B
build/checkout.js 42.6 kB
build/general-style-rtl.css 1.29 kB
build/general-style.css 1.29 kB
build/handpicked-products.js 7.36 kB
build/legacy-template.js 2.79 kB
build/mini-cart-contents-block/empty-cart-frontend.js 365 B
build/mini-cart-contents-block/filled-cart-frontend.js 229 B
build/mini-cart-contents-block/footer--mini-cart-contents-block/products-table-frontend.js 4.69 kB
build/mini-cart-contents-block/items-frontend.js 237 B
build/mini-cart-contents-block/products-table-frontend.js 289 B
build/mini-cart-contents-block/shopping-button-frontend.js 288 B
build/mini-cart-contents-block/title-frontend.js 367 B
build/mini-cart-contents.js 22.9 kB
build/mini-cart-frontend.js 1.71 kB
build/mini-cart.js 4.58 kB
build/price-format.js 1.19 kB
build/product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00.js 223 B
build/product-add-to-cart-frontend.js 6.95 kB
build/product-best-sellers.js 7.71 kB
build/product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 436 B
build/product-button--product-image--product-rating--product-sale-badge--product-title.js 300 B
build/product-button.js 1.57 kB
build/product-categories.js 2.42 kB
build/product-category-list-frontend.js 879 B
build/product-category-list.js 503 B
build/product-category.js 8.69 kB
build/product-image.js 1.59 kB
build/product-new.js 7.71 kB
build/product-on-sale.js 8.03 kB
build/product-query.js 647 B
build/product-rating-frontend.js 1.16 kB
build/product-rating.js 742 B
build/product-sku-frontend.js 381 B
build/product-sku.js 379 B
build/product-stock-indicator-frontend.js 993 B
build/product-stock-indicator.js 624 B
build/product-summary.js 920 B
build/product-tag-list-frontend.js 872 B
build/product-tag-list.js 498 B
build/product-tag.js 8.08 kB
build/product-title-frontend.js 1.31 kB
build/product-top-rated.js 7.95 kB
build/products-by-attribute.js 8.63 kB
build/vendors--cart-blocks/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66-frontend.js 5.26 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.14 kB
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.85 kB
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6-frontend.js 19.1 kB
build/vendors--mini-cart-contents-block/footer-frontend.js 6.86 kB
build/vendors--product-add-to-cart-frontend.js 7.53 kB
build/wc-blocks-data.js 9.87 kB
build/wc-blocks-editor-style-rtl.css 5.08 kB
build/wc-blocks-editor-style.css 5.09 kB
build/wc-blocks-google-analytics.js 1.56 kB
build/wc-blocks-middleware.js 930 B
build/wc-blocks-registry.js 2.7 kB
build/wc-blocks-shared-context.js 1.52 kB
build/wc-blocks-shared-hocs.js 1.14 kB
build/wc-blocks-vendors-style-rtl.css 1.95 kB
build/wc-blocks-vendors-style.css 1.95 kB
build/wc-blocks.js 2.62 kB
build/wc-payment-method-bacs.js 816 B
build/wc-payment-method-cheque.js 811 B
build/wc-payment-method-cod.js 909 B
build/wc-payment-method-paypal.js 837 B
build/wc-settings.js 2.6 kB

compressed-size-action

Base automatically changed from update/filter-by-attr-ui-settings to trunk August 19, 2022 06:55
@albarin albarin force-pushed the update/filter-by-attr-block-ui branch from f286363 to 6732bcf Compare August 19, 2022 08:53
@albarin albarin force-pushed the update/filter-by-attr-block-ui branch from 14af209 to 310caf7 Compare August 19, 2022 08:55
@albarin albarin self-assigned this Aug 19, 2022
@albarin albarin added block-type: filter blocks Issues related to all of the filter blocks. block: filter by attribute Issues related to the Filter by Attribute block. labels Aug 19, 2022
@albarin albarin marked this pull request as ready for review August 19, 2022 10:48
@rubikuserbot rubikuserbot requested review from a team and gigitux and removed request for a team August 19, 2022 10:48
@tjcafferkey
Copy link
Contributor

Hey @albarin just a few things Ive noticed:

  • If you use this filter block in a block template (e.g. shop) then clicking "Reset" does not refresh the page as it should do. You will probably need to call the onSubmit for this to happen.
  • If you use this filter block in conjunction with the All Products block, clicking reset does not refresh the results. Im guessing if you fix the above point, this will also be fixed.
  • Also on the block template page (e.g. shop) the alignment is off. Please see the below screenshot.

Screenshot 2022-08-19 at 14 37 55

@vivialice
Copy link

Hey Alba! This is looking really great 🤩 I have made a few notes below:

For both, can we disable the Apply button by lightening the colour before a change has been made? For example, when you reset the filter list, it can be unclear that the user needs to save the changes and I think the visual feedback would help here.

Dropdown:
I think it's fine we aren't able to put the link and button within the overlay. Likewise with the badge, using what we have is okay.

I noticed the dropdown arrow is missing - are we able to add that in?

After hitting reset, we don't need to open the dropdown, just clear the chips. When the user deletes a chip directly, it is okay to keep the overlay open.

Are we able to match the chip styles in Active Filters?

List:
Can we reduce the vertical spacing between list items? It feels a bit too big at the moment.

I will do another review of these tomorrow, but that's what stuck out to me so far!

Copy link
Member

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

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

@albarin This is looking great! The block tested well on my end. However, I found a scenario where the behavior of the Reset button can be improved, please follow these steps to reproduce:

  1. Add the attribute filter block to the shop page.
  2. Enable the filter button.
  3. On the front end, select an attribute.
  4. Click on the Reset button, and see the page reloads.

The page doesn't reload when I do the same for Stock and Price filter blocks. So I'm wondering if we can do the same for the attribute filter block. I think we shouldn't reload the page when clicking the Reset button if the filter isn't applied.

@vivialice
Copy link

vivialice commented Aug 22, 2022

I took another look on my test site and I have a couple of other thoughts:

  • Are we able to reduce the button sizes? These should be a smaller style. Currently they are matching other CTAs on the site and lack heriarchy.

Screenshot 2022-08-22 at 11 39 28

  • Not sure if this in a separate issue, but can we remove filter by on the label headings?

  • I noticed the Heading sizes appear differently in the editor vs on the front end. I'm using TT2 theme. Not sure why this would be the case?

Editor:
Screenshot 2022-08-22 at 11 59 54

FE:
Screenshot 2022-08-22 at 12 00 15

  • This might still be in progress so apologies if it is, but the loading state includes the border and text and should only be a shape like the others.

Screenshot 2022-08-22 at 12 40 21

@albarin
Copy link
Contributor Author

albarin commented Aug 22, 2022

The page doesn't reload when I do the same for Stock and Price filter blocks. So I'm wondering if we can do the same for the attribute filter block. I think we shouldn't reload the page when clicking the Reset button if the filter isn't applied.

Good catch! I just pushed a fix :)

@vivialice
Copy link

Thanks guys! I just had a review and it's looking great.

Since we already have this issue to completely remove the headings #6845, do you think it's okey to keep them for now?

Hmm maybe. Do we have an ETA for this issue? How difficult of a change is it?

This will be tackled when we work on this other issue.

👍

I think Vivient also thought about that, that's why she put the apply filter button inside the dropdown. I like the reset and submit buttons being in a dedicated row, it's easier to style them and the block. But with the limitation of the , we need to find a workaround for this case.

Yes that is why I originally placed the button and links in the overlay. Keep me posted if you are able to find a solution for this.

@albarin
Copy link
Contributor Author

albarin commented Aug 23, 2022

Yes that is why I originally placed the button and links in the overlay. Keep me posted if you are able to find a solution for this.

What about something like this @vivialice 👇
Screenshot 2022-08-23 at 13 36 34

@albarin
Copy link
Contributor Author

albarin commented Aug 23, 2022

Hmm maybe. Do we have an ETA for this issue? How difficult of a change is it?

@tjcafferkey or @dinhtungdu do you have any news regarding the issue to remove the headings #6845 ? 🤔

@vivialice
Copy link

What about something like this @vivialice 👇

It's a good attempt but it's too inconsistent from the other blocks, so I don't think we should do this.

@tjcafferkey
Copy link
Contributor

@tjcafferkey or @dinhtungdu do you have any news regarding the issue to remove the headings #6845 ? 🤔

We're currently exploring a few approaches here. Im not sure on the ETA but it feels we may be close to an approach we can start to implement with a HOC.

It would also be good if @vivialice can take a look at the video in the PR too and post thoughts on it there.

@albarin albarin requested a review from dinhtungdu August 24, 2022 09:42
@albarin
Copy link
Contributor Author

albarin commented Aug 24, 2022

@tjcafferkey @dinhtungdu @vivialice I think the only thing missing here is to decide what to do with the Reset/Apply buttons when the dropdown is enabled. Does anyone have a better idea?
Should we merge this as is and tackle it in a separate PR?

@tjcafferkey
Copy link
Contributor

Should we merge this as is and tackle it in a separate PR?

I think we can tackle this separately and it shouldn't block this PR, but happy to go with the majority vote on this.

Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

@albarin I was playing around with this PR and I noticed a z-index issue when two dropdowns overlap, can you reproduce as well?

imatge

And one question about the design: when only a single item can be selected, could we remove the pill border around? It feels a bit strange.

imatge

@vivialice
Copy link

And one question about the design: when only a single item can be selected, could we remove the pill border around? It feels a bit strange.

That pill shouldn't be full width, what is happening here?

@albarin
Copy link
Contributor Author

albarin commented Aug 24, 2022

And one question about the design: when only a single item can be selected, could we remove the pill border around? It feels a bit strange.

That pill shouldn't be full width, what is happening here?

Totally missed testing the behavior for single item! It's fixed now :)

@albarin I was playing around with this PR and I noticed a z-index issue when two dropdowns overlap, can you reproduce as well?

Can someone give me a hand with this z-index? I've been trying but haven't managed to fix it so far 😞

Thanks for the review and the patience @Aljullu @vivialice, could you give another try to the single selection issue?

@tjcafferkey
Copy link
Contributor

Can someone give me a hand with this z-index?

on it 😄

Copy link
Contributor

@tjcafferkey tjcafferkey left a comment

Choose a reason for hiding this comment

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

It looks like the remaining issues raised by @vivialice and @Aljullu have been fixed. The only outstanding issue is the z-index one spotted by Albert, however we've decided to merge this PR and tackle this final issue independently. Good job on this PR @albarin !

@github-actions github-actions bot added this to the 8.4.0 milestone Aug 25, 2022
@albarin albarin merged commit 21a7a10 into trunk Aug 25, 2022
@albarin albarin deleted the update/filter-by-attr-block-ui branch August 25, 2022 10:01
@tarhi-saad tarhi-saad added type: enhancement The issue is a request for an enhancement. and removed status: ready to merge labels Aug 29, 2022
senadir pushed a commit to senadir/woocommerce-blocks that referenced this pull request Nov 12, 2022
* Add and style Reset and Apply buttons

* Style the dropdown option

* Fix class and label

* Fix checkbox margin in editor

* Fix alignment

* Fix the reset button

* Disable Apply button when no changes have been made to the filter to improve UX

* Reduce vertical spacing between list items

* Style chips

* Don't reload on reset if filters have not been applied

* Fix heading styles on the front end

* Add chevron down to filter by attribute dropdown ui component

* Force FormTokenField to remount on reset

* Fix dropdown z-index

* Reduce apply button margin

* Fix styles for single token selection

Co-authored-by: tjcafferkey <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: filter by attribute Issues related to the Filter by Attribute block. block-type: filter blocks Issues related to all of the filter blocks. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter by Attributes block: update the front-end and block panel according to the new design
6 participants