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

Conversation

@tjcafferkey
Copy link
Contributor

@tjcafferkey tjcafferkey commented Aug 11, 2022

Update the Filter by Stock UI to be inline with the new designs.

Fixes #6842

Accessibility

Other Checks

  • This PR adds/removes a feature flag & I've updated this doc.
  • This PR adds/removes an experimental interfaces and I've updated this doc.
  • I tagged two reviewers because this PR makes queries to the database or I think it might have some security impact.

Screenshots

Before After
Screenshot 2022-08-17 at 12 33 57 Screenshot 2022-08-17 at 12 32 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 Stock component to a page using the All Products block, and also a block template.
  2. Check that the control panel for this block looks like the design (minus Typography)
  3. On both the page and the template frontends select a checkbox and observe that it looks as it should do with the design.
  4. Check that a "Reset" button appears and clicking this resets the filter again.
  5. Now go to your Edit Page & Edit Template pages and enable "'Apply filters' button".
  6. On the frontends again, re-select your filter options and check that they are not applied immediately until you click "Apply"
  7. Check that when this block is used with the PHP template & the All Products block that regardless of whether the "Apply Filters" button is active, that clicking "Reset" immediately clears the selected filter options
  • Do not include in the Testing Notes

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

Performance Impact

Changelog

Update the design of the Filter Products by Stock block.

@tjcafferkey tjcafferkey added type: task The issue is an internally driven task (e.g. from another A8c team). block: filter by stock Issues related to the Filter by Stock block. labels Aug 11, 2022
@tjcafferkey tjcafferkey self-assigned this Aug 11, 2022
@tjcafferkey tjcafferkey changed the title Update Filter by Stock controls and UI to include custom checkbox and… Update Filter by Stock block Aug 11, 2022
@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-6883.zip

@github-actions
Copy link
Contributor

github-actions bot commented Aug 11, 2022

Size Change: +612 B (0%)

Total Size: 868 kB

Filename Size Change
build/active-filters-frontend.js 7.34 kB +2 B (0%)
build/active-filters.js 7.99 kB -1 B (0%)
build/all-products-frontend.js 18.1 kB +12 B (0%)
build/all-products.js 33.7 kB -1 B (0%)
build/all-reviews.js 7.8 kB -1 B (0%)
build/attribute-filter-frontend.js 21.9 kB -14 B (0%)
build/attribute-filter.js 12.9 kB +7 B (0%)
build/blocks-checkout.js 17.4 kB +6 B (0%)
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.16 kB +1 B (0%)
build/cart-blocks/cart-express-payment-frontend.js 5.09 kB -5 B (0%)
build/cart-blocks/cart-items-frontend.js 299 B +1 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 428 B -2 B (0%)
build/cart-blocks/empty-cart-frontend.js 346 B +1 B (0%)
build/cart-blocks/order-summary-coupon-form-frontend.js 2.65 kB +2 B (0%)
build/cart-blocks/order-summary-discount-frontend.js 2.15 kB +1 B (0%)
build/cart-blocks/order-summary-fee-frontend.js 274 B +1 B (0%)
build/cart-blocks/order-summary-heading-frontend.js 454 B -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-shipping-frontend.js 426 B +1 B (0%)
build/cart-blocks/proceed-to-checkout-frontend.js 1.15 kB -3 B (0%)
build/cart-frontend.js 47 kB -3 B (0%)
build/cart.js 41.3 kB +2 B (0%)
build/checkout-blocks/actions-frontend.js 1.42 kB -4 B (0%)
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 4.12 kB -3 B (0%)
build/checkout-blocks/contact-information-frontend.js 2.83 kB -2 B (0%)
build/checkout-blocks/express-payment-frontend.js 5.38 kB -7 B (0%)
build/checkout-blocks/fields-frontend.js 345 B +1 B (0%)
build/checkout-blocks/order-note-frontend.js 1.07 kB -2 B (0%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 2.8 kB -2 B (0%)
build/checkout-blocks/order-summary-discount-frontend.js 2.26 kB -1 B (0%)
build/checkout-blocks/order-summary-shipping-frontend.js 604 B +3 B (0%)
build/checkout-blocks/payment-frontend.js 7.7 kB -4 B (0%)
build/checkout-blocks/shipping-methods-frontend.js 4.74 kB -1 B (0%)
build/checkout-frontend.js 49.2 kB -6 B (0%)
build/checkout.js 42.6 kB -1 B (0%)
build/featured-category.js 13.2 kB +4 B (0%)
build/featured-product.js 13.5 kB -4 B (0%)
build/handpicked-products.js 7.36 kB -3 B (0%)
build/legacy-template.js 2.79 kB +3 B (0%)
build/mini-cart-component-frontend.js 16.8 kB -1 B (0%)
build/mini-cart-contents-block/footer--mini-cart-contents-block/products-table-frontend.js 4.69 kB +1 B (0%)
build/mini-cart-contents-block/footer-frontend.js 6.98 kB -5 B (0%)
build/mini-cart-contents.js 22.9 kB +10 B (0%)
build/mini-cart-frontend.js 1.71 kB -1 B (0%)
build/price-filter-frontend.js 13.3 kB +66 B (+1%)
build/price-filter.js 9.09 kB -5 B (0%)
build/product-add-to-cart--product-button--product-image--product-title.js 2.66 kB +1 B (0%)
build/product-add-to-cart-frontend.js 6.95 kB -8 B (0%)
build/product-add-to-cart.js 6.88 kB +3 B (0%)
build/product-best-sellers.js 7.71 kB -1 B (0%)
build/product-button--product-image--product-rating--product-sale-badge--product-title.js 301 B +1 B (0%)
build/product-button-frontend.js 1.87 kB -2 B (0%)
build/product-button.js 1.57 kB -1 B (0%)
build/product-categories.js 2.42 kB +4 B (0%)
build/product-category-list-frontend.js 879 B -2 B (0%)
build/product-category-list.js 503 B -1 B (0%)
build/product-category.js 8.69 kB +1 B (0%)
build/product-image-frontend.js 1.88 kB -1 B (0%)
build/product-image.js 1.59 kB +2 B (0%)
build/product-new.js 7.71 kB +2 B (0%)
build/product-on-sale.js 8.03 kB +2 B (0%)
build/product-price-frontend.js 1.9 kB -2 B (0%)
build/product-price.js 1.51 kB +1 B (0%)
build/product-rating-frontend.js 1.16 kB -3 B (0%)
build/product-rating.js 743 B +1 B (0%)
build/product-sale-badge-frontend.js 1.13 kB -2 B (0%)
build/product-sale-badge.js 804 B +1 B (0%)
build/product-search.js 2.18 kB -1 B (0%)
build/product-sku-frontend.js 381 B +1 B (0%)
build/product-stock-indicator-frontend.js 993 B -2 B (0%)
build/product-stock-indicator.js 626 B +1 B (0%)
build/product-summary-frontend.js 1.29 kB -2 B (0%)
build/product-summary.js 921 B -1 B (0%)
build/product-tag-list-frontend.js 872 B -4 B (0%)
build/product-tag.js 8.08 kB +3 B (0%)
build/product-title-frontend.js 1.31 kB +2 B (0%)
build/product-title.js 922 B +1 B (0%)
build/product-top-rated.js 7.95 kB -1 B (0%)
build/products-by-attribute.js 8.63 kB +3 B (0%)
build/reviews-by-category.js 11.2 kB +4 B (0%)
build/reviews-by-product.js 12.3 kB -2 B (0%)
build/single-product-frontend.js 21.4 kB +15 B (0%)
build/single-product.js 10 kB +1 B (0%)
build/stock-filter-frontend.js 7.51 kB +121 B (+2%)
build/stock-filter.js 7.46 kB +152 B (+2%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.85 kB +1 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6-frontend.js 19.1 kB -3 B (0%)
build/vendors--mini-cart-contents-block/footer-frontend.js 6.86 kB -2 B (0%)
build/vendors--product-add-to-cart-frontend.js 7.53 kB +2 B (0%)
build/wc-blocks-style-rtl.css 22.4 kB +146 B (+1%)
build/wc-blocks-style.css 22.3 kB +145 B (+1%)
build/wc-blocks-vendors.js 54.5 kB -6 B (0%)
build/wc-blocks.js 2.62 kB -2 B (0%)
ℹ️ View Unchanged
Filename Size
build/cart-blocks/cart-order-summary-frontend.js 1.1 kB
build/cart-blocks/cart-totals-frontend.js 321 B
build/cart-blocks/filled-cart-frontend.js 781 B
build/cart-blocks/order-summary-subtotal-frontend.js 274 B
build/cart-blocks/order-summary-taxes-frontend.js 433 B
build/checkout-blocks/billing-address-frontend.js 891 B
build/checkout-blocks/order-summary-cart-items-frontend.js 3.66 kB
build/checkout-blocks/order-summary-fee-frontend.js 276 B
build/checkout-blocks/order-summary-frontend.js 1.1 kB
build/checkout-blocks/order-summary-subtotal-frontend.js 274 B
build/checkout-blocks/order-summary-taxes-frontend.js 433 B
build/checkout-blocks/shipping-address-frontend.js 1.03 kB
build/checkout-blocks/terms-frontend.js 1.23 kB
build/checkout-blocks/totals-frontend.js 325 B
build/general-style-rtl.css 1.29 kB
build/general-style.css 1.29 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/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.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-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 436 B
build/product-query.js 647 B
build/product-sku.js 381 B
build/product-tag-list.js 500 B
build/reviews-frontend.js 7.02 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/wc-blocks-data.js 9.87 kB
build/wc-blocks-editor-style-rtl.css 5.07 kB
build/wc-blocks-editor-style.css 5.07 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-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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 15, 2022

Script Dependencies Report

The compare-assets action has detected some changed script dependencies between this branch and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Removed
attribute-filter.js wc-blocks-checkout ⚠️
stock-filter.js wc-blocks-checkout ⚠️

This comment was automatically generated by the ./github/compare-assets action.

@tjcafferkey tjcafferkey marked this pull request as ready for review August 17, 2022 13:33
@tjcafferkey tjcafferkey requested a review from dinhtungdu August 17, 2022 13:33
@rubikuserbot rubikuserbot requested a review from a team August 17, 2022 13:33
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.

@tjcafferkey The PR is testing great on my end. The main functionalities work as expected.
I found some minor issues detailed below, please take a look!

  • There are some design updates that haven't been implemented in this PR:
    • The block name and description.

    • The product count now has the same color as the option label.

    • The checkbox size is 18x18px in the design. In my test for this PR, its size is actually 20x20px.

    • The focus outline for checkboxes is rounded, should we remove the radius to make it match the unfocused state style? cc @vivialice

      Screenshot image
  • About the Reset button, there is a case the behavior can be improved IMO:
    1. Add the block to the shop page and Enable the Apply Filter button.
    2. On the shop page, check a stock option.
    3. See the page reloads.
    4. See the Reset and Apply buttons both appear because a filter is selected now.
    5. Click on the Reset button, the page won't reload, and the Active Filters block won't update.
    6. We have to click on the Apply button to reset the filter.
      => IMO, clicking the Reset button should always reset the filter, even if the Apply filter button is enabled. cc @vivialice

@tjcafferkey
Copy link
Contributor Author

@dinhtungdu thanks for your review:

The block name and description.

I have updated the block name, but the description seems as it should be?

The product count now has the same color as the option label.

This has been sorted now.

The checkbox size is 18x18px in the design. In my test for this PR, its size is actually 20x20px.
The focus outline for checkboxes is rounded, should we remove the radius to make it match the unfocused state style? cc @\vivialice

We have decided to use the CheckboxControl from checkout for consistency across the UI. I will create a separate issue to move this component to a place that makes more sense seeing as its now used outside of checkout too. Haven't done this as part of this PR to limit scope and regression testing.

About the Reset button, there is a case the behavior can be improved IMO

Hmm, I am not sure but I totally understand your point. I will leave this up to @vivialice to decide upon.

@Aljullu I have addressed your feedback also, and the PR is updated with the new checkbox component. Good catch! I should have known one should have existed.

@vivialice
Copy link

The focus outline for checkboxes is rounded, should we remove the radius to make it match the unfocused state style? cc @vivialice

Yes! 👍

clicking the Reset button should always reset the filter, even if the Apply filter button is enabled.

Correct. I also had forgotten the whole page refreshes. I remember during one of the past iterations we spoke about loading states - has this been updated or accounted for if not?

@tjcafferkey
Copy link
Contributor Author

I remember during one of the past iterations we spoke about loading states - has this been updated or accounted for if not?

@vivialice If you mean the loading placeholders, this will be done in a separate pull request.

Correct.

Thanks! I will update this behaviour now then

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.

@tjcafferkey The update looks good, but I found a minor issue with the reset button. Other than that, this is LGTM!

Steps to reproduce:

  1. Enable the Apply filter button.
  2. On the front end, select a stock filter.
  3. Click on the reset button.
  4. See the filter doesn't reset.

@tjcafferkey
Copy link
Contributor Author

Good catch @dinhtungdu Ive addressed that here 71ad0df

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.

Thanks for the lighting fast update! 🚀

@github-actions github-actions bot added this to the 8.4.0 milestone Aug 19, 2022
@tjcafferkey tjcafferkey merged commit d524f43 into trunk Aug 19, 2022
@tjcafferkey tjcafferkey deleted the update/filter-by-stock-ui branch August 19, 2022 08:04
@tarhi-saad tarhi-saad added type: enhancement The issue is a request for an enhancement. block-type: filter blocks Issues related to all of the filter blocks. and removed status: ready to merge type: task The issue is an internally driven task (e.g. from another A8c team). labels Aug 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

block: filter by stock Issues related to the Filter by Stock 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 Stock block: update the front-end and block panel according to the new design

6 participants