This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Fix inconsistent HTML of rating section #5552
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nielslange
added
type: bug
The issue/PR concerns a confirmed bug.
focus: global styles
Issues that involve styles/css/layout structure.
labels
Jan 12, 2022
rubikuserbot
requested review from
a team and
mikejolley
and removed request for
a team
January 12, 2022 11:39
nielslange
added
block: all products
Issues related to the all products block.
block: all reviews
Issues related to the All Reviews block.
block: single product
Issues related to the single product block.
block: reviews by product
Issues related to the Reviews by Product block.
block: reviews by category
Issues related to the Reviews by Category block.
labels
Jan 12, 2022
Size Change: +576 B (0%) Total Size: 815 kB
ℹ️ View Unchanged
|
mikejolley
approved these changes
Jan 12, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I also tested the single products block which also used the correct markup.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block: all products
Issues related to the all products block.
block: all reviews
Issues related to the All Reviews block.
block: reviews by category
Issues related to the Reviews by Category block.
block: reviews by product
Issues related to the Reviews by Product block.
block: single product
Issues related to the single product block.
focus: global styles
Issues that involve styles/css/layout structure.
type: bug
The issue/PR concerns a confirmed bug.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1916
Notes
In #1916, @dashkevych reported that the underlying HTML code of the rating sections is inconsistent. To solve this issue, I checked which of the current blocks is showing the rating section.
assets/js/atomic/product-elements/rating/block.js
assets/js/base/components/reviews/review-list-item/index.js
src/BlockTypes/AbstractProductGrid.php
Rating type 3 shows the correct HTML code and is defined in:
https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b72efda06f68d1caa5ab225bfb057489cf92ecd8/src/BlockTypes/AbstractProductGrid.php#L559-L564
This part calls the following WooCommerce core functions:
https://github.com/woocommerce/woocommerce/blob/159ceb3f3548c7d04140b9c8f48236b6afd36fee/plugins/woocommerce/includes/wc-template-functions.php#L3540-L3582
Rating type 1 shows the incorrect HTML code and is defined in:
https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b72efda06f68d1caa5ab225bfb057489cf92ecd8/assets/js/atomic/blocks/product-elements/rating/block.js#L44-L65
Rating type 2 also shows the incorrect HTML code and is defined in:
https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b72efda06f68d1caa5ab225bfb057489cf92ecd8/assets/js/base/components/reviews/review-list-item/index.js#L127-L137
Rating types 1 and 2 have a slightly different logic. While rating type 1 shows individual ratings, rating type 2 shows all the average rating per product. Therefore, their final structure is slightly different.
Screenshots
Rating type 1 - before
Rating type 1 - after
Rating type 2 - before
Rating type 2 - after
Testing
Manual Testing
Rating type 1 - Single rating
All Products
block.All Products
block on the frontend.Rating type 1 - Multiple ratings
All Products
block.All Products
block on the frontend.Rating type 2 - Single rating
All Reviews
block.All Reviews
block on the frontend.User Facing Testing
Changelog