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

Fix: Filter button is not aligned with the input field #4814

Merged
merged 3 commits into from
Sep 30, 2021

Conversation

dinhtungdu
Copy link
Member

@dinhtungdu dinhtungdu commented Sep 23, 2021

Fixes #2560

This PR fixes the alignment issue of the Filter Products by Attribute block when using Dropdown as the display type. This PR also fixes the height of the input field, makes it equal to the height of the filter button.

Manual Testing

How to test the changes in this Pull Request:

  1. Add the Filter Products by Attribute block and select 'Display Style: Dropdown' and check 'Filter button'.
  2. See the filter button aligned correctly on both editor and front end.

Performance Impact

Changelog

Fixed: Filter button from Filter Products by Attribute block is not aligned with the input field

@dinhtungdu dinhtungdu self-assigned this Sep 23, 2021
@nerrad nerrad requested review from a team and Aljullu and removed request for a team September 23, 2021 08:13
@github-actions
Copy link
Contributor

github-actions bot commented Sep 23, 2021

Size Change: -17.4 kB (-1%)

Total Size: 1.23 MB

Filename Size Change
build/active-filters-frontend.js 8.35 kB +9 B (0%)
build/active-filters.js 8.01 kB +2 B (0%)
build/all-products.js 37 kB +3 B (0%)
build/all-reviews.js 9.56 kB +3 B (0%)
build/atomic-block-components/add-to-cart--atomic-block-components/button.js 1.81 kB +2 B (0%)
build/atomic-block-components/add-to-cart-frontend.js 8.39 kB +9 B (0%)
build/atomic-block-components/add-to-cart.js 7.72 kB -3 B (0%)
build/atomic-block-components/button-frontend.js 1.74 kB -2 B (0%)
build/atomic-block-components/image-frontend.js 1.88 kB +1 B (0%)
build/atomic-block-components/image.js 1.35 kB -1 B (0%)
build/atomic-block-components/price-frontend.js 2.13 kB -1 B (0%)
build/atomic-block-components/rating.js 567 B +1 B (0%)
build/atomic-block-components/sale-badge-frontend.js 861 B -1 B (0%)
build/atomic-block-components/sku-frontend.js 392 B +1 B (0%)
build/atomic-block-components/sku.js 392 B -1 B (0%)
build/atomic-block-components/stock-indicator-frontend.js 612 B -1 B (0%)
build/atomic-block-components/summary-frontend.js 908 B +2 B (0%)
build/atomic-block-components/tag-list-frontend.js 467 B -1 B (0%)
build/atomic-block-components/tag-list.js 472 B +1 B (0%)
build/atomic-block-components/title-frontend.js 1.47 kB +7 B (0%)
build/atomic-block-components/title.js 1.29 kB +1 B (0%)
build/attribute-filter-frontend.js 18.6 kB -139 B (-1%)
build/attribute-filter.js 12.2 kB +16 B (0%)
build/blocks-checkout.js 21.1 kB +4 B (0%)
build/cart-frontend.js 91.6 kB +273 B (0%)
build/cart-i2-frontend.js 52.5 kB -38.5 kB (-42%) 🎉
build/cart-i2.js 47.8 kB +176 B (0%)
build/cart.js 46.6 kB +32 B (0%)
build/checkout-blocks/actions-frontend.js 1.47 kB +3 B (0%)
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 0 B -5.09 kB (removed) 🏆
build/checkout-blocks/billing-address-frontend.js 2.64 kB +1.5 kB (+132%) 🆘
build/checkout-blocks/contact-information-frontend.js 3.88 kB +5 B (0%)
build/checkout-blocks/express-payment--checkout-blocks/payment-frontend.js 0 B -4.83 kB (removed) 🏆
build/checkout-blocks/express-payment-frontend.js 1.92 kB +88 B (+5%) 🔍
build/checkout-blocks/order-note-frontend.js 1.56 kB +2 B (0%)
build/checkout-blocks/order-summary-frontend.js 12.7 kB +60 B (0%)
build/checkout-blocks/payment-frontend.js 4.58 kB +69 B (+2%)
build/checkout-blocks/sample-frontend.js 0 B -249 B (removed) 🏆
build/checkout-blocks/shipping-address-frontend.js 3.04 kB +1.42 kB (+88%) 🆘
build/checkout-blocks/shipping-methods-frontend.js 5.55 kB +8 B (0%)
build/checkout-blocks/terms-frontend.js 1.64 kB +4 B (0%)
build/checkout-blocks/totals-frontend.js 271 B +1 B (0%)
build/checkout-frontend.js 54.4 kB +132 B (0%)
build/checkout.js 52.7 kB +232 B (0%)
build/featured-product.js 9.42 kB +2 B (0%)
build/handpicked-products.js 6.26 kB +1 B (0%)
build/mini-cart-component-frontend.js 36.5 kB -66 B (0%)
build/mini-cart-frontend.js 2.35 kB -5 B (0%)
build/price-filter-frontend.js 14.3 kB -93 B (-1%)
build/product-best-sellers.js 6.61 kB +1 B (0%)
build/product-categories.js 3.38 kB +1 B (0%)
build/product-category.js 7.49 kB +4 B (0%)
build/product-new.js 6.77 kB +3 B (0%)
build/product-on-sale.js 7.13 kB +1 B (0%)
build/product-search.js 2.66 kB -1 B (0%)
build/product-tag.js 6.58 kB +1 B (0%)
build/product-top-rated.js 6.74 kB +4 B (0%)
build/products-by-attribute.js 7.7 kB +2 B (0%)
build/reviews-by-category.js 11.5 kB +3 B (0%)
build/reviews-by-product.js 13 kB +4 B (0%)
build/reviews-frontend.js 8.96 kB -16 B (0%)
build/single-product-frontend.js 26.2 kB +32 B (0%)
build/single-product.js 9.76 kB +1 B (0%)
build/stock-filter-frontend.js 8.76 kB -5 B (0%)
build/stock-filter.js 7.81 kB +1 B (0%)
build/vendors--atomic-block-components/add-to-cart--checkout-blocks/billing-address--checkout-blocks/orde--63cde524-frontend.js 0 B -16.2 kB (removed) 🏆
build/vendors--atomic-block-components/add-to-cart-frontend.js 4.77 kB -1 B (0%)
build/vendors--atomic-block-components/price--checkout-blocks/order-summary--checkout-blocks/shipping-methods-frontend.js 0 B -5.71 kB (removed) 🏆
build/vendors--checkout-blocks/billing-address--checkout-blocks/order-summary--checkout-blocks/shipping-address-frontend.js 0 B -5.02 kB (removed) 🏆
build/vendors--checkout-blocks/order-summary-frontend.js 0 B -3.11 kB (removed) 🏆
build/wc-blocks-editor-style-rtl.css 15.6 kB +21 B (0%)
build/wc-blocks-editor-style.css 15.6 kB +19 B (0%)
build/wc-blocks-registry.js 3.71 kB -23 B (-1%)
build/wc-blocks-shared-context.js 1.54 kB +1 B (0%)
build/wc-blocks-style-rtl.css 20.5 kB +339 B (+2%)
build/wc-blocks-style.css 20.4 kB +345 B (+2%)
build/wc-blocks-vendors.js 254 kB -4 B (0%)
build/wc-blocks.js 3.5 kB -1 B (0%)
build/cart-blocks/checkout-button-frontend.js 2.4 kB +2.4 kB (new file) 🆕
build/cart-blocks/empty-cart-frontend.js 327 B +327 B (new file) 🆕
build/cart-blocks/express-payment--checkout-blocks/express-payment--checkout-blocks/payment-frontend.js 4.73 kB +4.73 kB (new file) 🆕
build/cart-blocks/express-payment-frontend.js 1.58 kB +1.58 kB (new file) 🆕
build/cart-blocks/filled-cart-frontend.js 781 B +781 B (new file) 🆕
build/cart-blocks/items-frontend.js 254 B +254 B (new file) 🆕
build/cart-blocks/line-items-frontend.js 5.52 kB +5.52 kB (new file) 🆕
build/cart-blocks/order-summary--checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 3.69 kB +3.69 kB (new file) 🆕
build/cart-blocks/order-summary-frontend.js 7.31 kB +7.31 kB (new file) 🆕
build/cart-blocks/totals-frontend.js 269 B +269 B (new file) 🆕
build/vendors--atomic-block-components/add-to-cart--cart-blocks/order-summary--checkout-blocks/billing-ad--c5eb4dcd-frontend.js 16.2 kB +16.2 kB (new file) 🆕
build/vendors--atomic-block-components/price--cart-blocks/line-items--cart-blocks/order-summary--checkout--8a3571de-frontend.js 5.71 kB +5.71 kB (new file) 🆕
build/vendors--cart-blocks/line-items--checkout-blocks/order-summary-frontend.js 3.1 kB +3.1 kB (new file) 🆕
build/vendors--cart-blocks/order-summary--checkout-blocks/billing-address--checkout-blocks/order-summary---eb4d2cec-frontend.js 5.02 kB +5.02 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
build/all-products-frontend.js 23.1 kB
build/atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b.js 2.66 kB
build/atomic-block-components/add-to-cart--atomic-block-components/image--atomic-block-components/title.js 332 B
build/atomic-block-components/button.js 875 B
build/atomic-block-components/category-list-frontend.js 472 B
build/atomic-block-components/category-list.js 476 B
build/atomic-block-components/price.js 2.11 kB
build/atomic-block-components/rating-frontend.js 563 B
build/atomic-block-components/sale-badge.js 869 B
build/atomic-block-components/stock-indicator.js 611 B
build/atomic-block-components/summary.js 911 B
build/checkout-blocks/fields-frontend.js 290 B
build/featured-category.js 7.73 kB
build/mini-cart.js 2.34 kB
build/price-filter.js 9.63 kB
build/price-format.js 1.37 kB
build/wc-blocks-data.js 11.3 kB
build/wc-blocks-google-analytics.js 1.98 kB
build/wc-blocks-middleware.js 1.47 kB
build/wc-blocks-shared-hocs.js 1.75 kB
build/wc-blocks-vendors-style-rtl.css 1.37 kB
build/wc-blocks-vendors-style.css 1.37 kB
build/wc-payment-method-bacs.js 806 B
build/wc-payment-method-cheque.js 806 B
build/wc-payment-method-cod.js 898 B
build/wc-payment-method-paypal.js 839 B
build/wc-payment-method-stripe.js 12.2 kB
build/wc-settings.js 2.91 kB

compressed-size-action

@dinhtungdu dinhtungdu added type: bug The issue/PR concerns a confirmed bug. block: filter by attribute Issues related to the Filter by Attribute block. labels Sep 23, 2021
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.

This is looking good, thanks for working on this @dinhtungdu! There are a couple of edge cases that I think might be worth addressing in this PR if that sounds good.

If I add the block directly into a page so it occupies the entire width, would it be possible to make the input field to span almost to touch the button (only leaving a small margin between them)?

Current Desired

Another case is when adding the block inside the Columns block (with three or more columns), then it's still breaking into two lines:

Current Desired

@dinhtungdu
Copy link
Member Author

@Aljullu Thanks for the head-up! I updated the PR to cover the cases you mentioned above. Please take another look!

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.

Thanks for updating this PR @dinhtungdu! I found one last edge case:

If you add the Filter block inside a three-column block, it overflows the available space (you can see it if you make its column to have a colored background):
imatge
I spent some time trying to figure out what's going on here. It looks like min-width: 0 is ignored in inputs if their size attribute forces them to be wider. I wonder if we could set the input size to be something very low and then set the min-width to 100%. I guess this way it would not overflow?

@dinhtungdu dinhtungdu requested a review from Aljullu September 29, 2021 11:00
@dinhtungdu
Copy link
Member Author

@Aljullu thanks for the catch! I fixed the issue and tested it on Chrome/Firefox/Safari. Please take another look!

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.

Thanks for the update! This is ready to merge now. :shipit:

.wc-block-attribute-filter-dropdown {
flex-grow: 1;
max-width: unset;
width: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, much better and simpler fix than the one I suggested. Good catch! 👌

@github-actions github-actions bot modified the milestone: 6.0.0 Sep 29, 2021
@senadir senadir modified the milestones: 6.0.0, 6.1.0 Sep 29, 2021
@Aljullu Aljullu merged commit 64e7615 into trunk Sep 30, 2021
@Aljullu Aljullu deleted the fix/2560-button-alignment branch September 30, 2021 09:09
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. type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter by Attribute: 'Go' button is not aligned with the input field
3 participants