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

Improve Reviews by Product accessibility #861

Merged
merged 3 commits into from
Aug 15, 2019

Conversation

Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Aug 14, 2019

Part of #658.

This PR improves the Reviews by Product block accessibility so it can be easily used with a screen reader. It implements the suggestion from #841 (comment) and adds some notices when the reviews list is updated.

This PR adds a new dependency to the frontend @wordpress/a11y. It's quite lightweight and wasn't easy to replace with vanilla JS.

Accessibility

How to test the changes in this Pull Request:

  1. Create a post with a Reviews by Product block.
  2. Using a screen reader, navigate the post.
  3. Notice it reads Order reviews by (instead of Order by) and Load more reviews (intead of Load more), making it easy to know what the select and the button refer too.
  4. Update the order and click on Load more and verify it announces the list has been updated when the new reviews have been loaded.

@Aljullu Aljullu added status: needs review focus: accessibility The issue/PR is related to accessibility. labels Aug 14, 2019
@Aljullu Aljullu added this to the 2.4 milestone Aug 14, 2019
@Aljullu Aljullu requested a review from a team August 14, 2019 09:33
@Aljullu Aljullu self-assigned this Aug 14, 2019
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.

Code wise looks pretty good, however I am getting this error in the editor for the Load more button:

Warning: Failed prop type: The prop `onClick` is marked as required in `LoadMoreButton`, but its value is `undefined`.

The error in my case appeared when I started with content that was not restricted by the load more boundaries and then decreased the Starting number of reviews to a number less than the total reviews available.

And the load more button is not only non-functional in the editor but is also styled natively:

However, on the frontend, the load more button is both functional and styled correctly.

@Aljullu
Copy link
Contributor Author

Aljullu commented Aug 15, 2019

Code wise looks pretty good, however I am getting this error in the editor for the Load more button:

My bad. 🤦‍♂️ Should be fixed in a0aa5ae.

non-functional

I guess that's to be expected in the editor, right? Making blocks interactive in the editor might be confusing for users because when publishing the post, they will always get the initial state defined by attributes. So I think the editor must always display that initial state instead of reacting to controls.

but is also styled natively

Shouldn't that be implemented by themes? We don't know how each theme styles buttons, so adding an specific style to the editor would generate unexpected results.

@nerrad
Copy link
Contributor

nerrad commented Aug 15, 2019

I guess that's to be expected in the editor, right? Making blocks interactive in the editor might be confusing for users because when publishing the post, they will always get the initial state defined by attributes. So I think the editor must always display that initial state instead of reacting to controls.

Personally I think it'll be equally confusing for users who go to click the button and nothing happens. I understand the reasoning for scenarios where having blocks interactive in the editor could add more complexity for users but I don't think this is one of them. Load more... imo is similar to the "read more..." functionality here. At a minimum, if we're not going to make this action functional in the editor we should provide some indication to the user for why it is disabled. Accessibility likely applies here as well.

Shouldn't that be implemented by themes? We don't know how each theme styles buttons, so adding an specific style to the editor would generate unexpected results.

Sure, I'm using storefront, shouldn't the style of the button in the editor match the frontend then? Is that something Storefront will need to account for? I know this potentially strays into a general GB problem (themes have to support the editor for styles), but I think at a minimum we should make note of any things that our own theme can be serve as an example for?

@Aljullu
Copy link
Contributor Author

Aljullu commented Aug 15, 2019

Personally I think it'll be equally confusing for users who go to click the button and nothing happens. I understand the reasoning for scenarios where having blocks interactive in the editor could add more complexity for users but I don't think this is one of them. Load more... imo is similar to the "read more..." functionality here. At a minimum, if we're not going to make this action functional in the editor we should provide some indication to the user for why it is disabled.

Besides the Load more button, there is also the Order by select. What I'm concerned about it is that if we let users interact with the Order by select in the editor, should it update the attributes or not? A user might expect that after changing the select value in the editor, attributes will be updated, since that's what they are seeing in the screen, right?

But then, why not doing the same with Load more? If a user clicks on Load more so 20 reviews become visible, should that update the Starting Number of Reviews attribute or not? Wouldn't it be confusing that changes in the Order by select update the attributes while clicking on Load more doesn't?

I don't have any strong opinion here and I agree with your points, but at the same time, buttons from product grids like Products by Category or the Button block itself don't trigger the same action in the editor and the frontend, so my thought is that users already know buttons and other interactive elements behave differently in the editor and the frontend.

Regarding why Read more (to expand one review's text) is enabled in the editor while Load more (to load more reviews) is not I don't have an answer for that. But my point of view is that Read more can be undone (you have a Hide full review button), while the only way to recover the initial status after Load more is clicked would be reloading the page.

Accessibility likely applies here as well.

Agree, we might want to wrap the block with <Disabled> in the editor? I pushed a commit that does that: 2fdaa59. I'm happy to revert it if we decide otherwise, I just pushed the commit so it's easier to test it. 🙂

Sure, I'm using storefront, shouldn't the style of the button in the editor match the frontend then? Is that something Storefront will need to account for? I know this potentially strays into a general GB problem (themes have to support the editor for styles), but I think at a minimum we should make note of any things that our own theme can be serve as an example for?

Right, those are good points. Another alternative would be copying the classes from the button block, like it looks like the product grids do. I created a testing PR that does that: #871.

If it sounds good let's move the discussion about styles there so we don't keep blocking this PR.

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.

If it sounds good let's move the discussion about styles there so we don't keep blocking this PR.

Sounds good 👍

@Aljullu Aljullu merged commit cdb9d26 into add/588-reviews-by-product-block Aug 15, 2019
@Aljullu Aljullu deleted the add/reviews-by-product-a11y branch August 15, 2019 14:16
Aljullu added a commit that referenced this pull request Aug 15, 2019
* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (#671)

* Add label to Reviews by Product controls count (#677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (#688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (#693)

* Create Reviews by Product block placeholder (#691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (#696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (#702)

* Lint errors

* Replace stringify query with addQueryArgs (#707)

* Add reviews endpoint (#705)

* Prevent state updates on unmounted components (#715)

* Add Order by and Load more controls in Reviews by Product frontend (#716)

* Export IconReviewsByProduct (#721)

* Fix Reviews by Product layout in IE11 (#723)

* Set minimum to per page input field (#731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (#730)

* Blocks API - Reviews endpoint with rating sort and category filtering (#726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (#732)

* Add placeholder animation (#733)

* Hook up Reviews by Product 'Order by' with endpoint (#736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (#740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (#773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (#774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (#788)

* Fix import of WithComponentID

* Add new settings to Reviews by Product block (#787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (#811)

* Reviews by product: Update review styling and content (#806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (#820)

* Fix Reviews by Product order by select not honoring default setting (#818)

* Read more component - change how clamped content is shown (#821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (#826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (#828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (#830)

* Fix bundlesize config not picking frontend files (#840)

* Reviews by Product: split 'block.js' into smaller chunks (#841)

* Split 'block.js' into smaller chunks

* Move frontend blocks to their specific folder

* Order imports

* Typo

* Add frontend components proptypes

* Fix indentation

* Call 'this.getDefaultArgs' directly inside 'getReviews'

* Move access to wc_product_block_data to the top of the file

* Rename 'frontend' folder to 'base'

* Rename base components and move styles to their folder

* Fix Reviews by Product using rating count instead of review count (#860)

* Improve Reviews by Product accessibility (#861)

* Improve Reviews by Product accessibility

* Make 'onClick' prop not required in <LoadMoreButton>

* Wrap Reviews by Product editor block with <Disabled>

* Reviews: fix reviews without rating not appearing when sorting by rating (#863)
@Aljullu Aljullu added the skip-changelog PRs that you don't want to appear in the changelog. label Aug 16, 2019
mikejolley added a commit that referenced this pull request Aug 21, 2019
* Prevent interaction with slider

* Show input fields toggle

* Placeholder content and icons

* Update dependency rimraf to v2.7.0 (#858)

* placeholder styling

* remove unnecessary config (#862)

* Filter button and styling

* Show/hide placeholder based on product count

* Update dependency rimraf to v2.7.1 (#867)

* Use correct parameter order for implode. Solves deprecation notice in PHP 7.4 (#857)

* Add description to blocks added in last releases (#869)

* Limit max width

* Prevent wrap

* handles src file

* Introduce withCategory HOC for featured category block (#846)

* Introduce withCategory hoc

* Refactor featured category to use new hoc

* Update docblocks

* Add README note for PHP deprecation notices

* Remove screen-reader-text css rules (#849)

* Align stars left (#866)

* bool

* Create Reviews by Product block (#658)

* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (#671)

* Add label to Reviews by Product controls count (#677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (#688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (#693)

* Create Reviews by Product block placeholder (#691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (#696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (#702)

* Lint errors

* Replace stringify query with addQueryArgs (#707)

* Add reviews endpoint (#705)

* Prevent state updates on unmounted components (#715)

* Add Order by and Load more controls in Reviews by Product frontend (#716)

* Export IconReviewsByProduct (#721)

* Fix Reviews by Product layout in IE11 (#723)

* Set minimum to per page input field (#731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (#730)

* Blocks API - Reviews endpoint with rating sort and category filtering (#726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (#732)

* Add placeholder animation (#733)

* Hook up Reviews by Product 'Order by' with endpoint (#736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (#740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (#773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (#774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (#788)

* Fix import of WithComponentID

* Add new settings to Reviews by Product block (#787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (#811)

* Reviews by product: Update review styling and content (#806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (#820)

* Fix Reviews by Product order by select not honoring default setting (#818)

* Read more component - change how clamped content is shown (#821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (#826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (#828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (#830)

* Fix bundlesize config not picking frontend files (#840)

* Reviews by Product: split 'block.js' into smaller chunks (#841)

* Split 'block.js' into smaller chunks

* Move frontend blocks to their specific folder

* Order imports

* Typo

* Add frontend components proptypes

* Fix indentation

* Call 'this.getDefaultArgs' directly inside 'getReviews'

* Move access to wc_product_block_data to the top of the file

* Rename 'frontend' folder to 'base'

* Rename base components and move styles to their folder

* Fix Reviews by Product using rating count instead of review count (#860)

* Improve Reviews by Product accessibility (#861)

* Improve Reviews by Product accessibility

* Make 'onClick' prop not required in <LoadMoreButton>

* Wrap Reviews by Product editor block with <Disabled>

* Reviews: fix reviews without rating not appearing when sorting by rating (#863)

* Update assets/css/style.scss

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Pin dependencies (#872)

* Update dependency webpack to v4.39.2 (#855)

* Update dependency @woocommerce/components to v3.2.0 (#875)

* Update Reviews styles so it looks the same in the editor and the frontend (#871)

* Update Node.js to v10.16.3 (#874)

* Move wc_product_block_data variables to constants file (#870)

* Update dependency webpack-cli to v3.3.7 (#880)

* Add changelog script (#878)

* Add changelog script

* Adapt changelog script to WooCommerce Blocks

* Minor improvements

* Update dependency lint-staged to v9.2.3 (#879)

* Pin dependencies (#883)

* Update dependency eslint to v6.2.0 (#881)

* Reviews by category block (#804)

* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (#671)

* Add label to Reviews by Product controls count (#677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (#688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (#693)

* Create Reviews by Product block placeholder (#691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (#696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (#702)

* Lint errors

* Replace stringify query with addQueryArgs (#707)

* Add reviews endpoint (#705)

* Prevent state updates on unmounted components (#715)

* Add Order by and Load more controls in Reviews by Product frontend (#716)

* Export IconReviewsByProduct (#721)

* Fix Reviews by Product layout in IE11 (#723)

* Set minimum to per page input field (#731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (#730)

* Blocks API - Reviews endpoint with rating sort and category filtering (#726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (#732)

* Add placeholder animation (#733)

* Hook up Reviews by Product 'Order by' with endpoint (#736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (#740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (#773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (#774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (#788)

* Inital block setup

* Fix import of WithComponentID

* Render the category reviews

* Add new settings to Reviews by Product block (#787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (#811)

* Reviews by product: Update review styling and content (#806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (#820)

* Fix Reviews by Product order by select not honoring default setting (#818)

* Read more component - change how clamped content is shown (#821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (#826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (#828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (#830)

* Update based on product reviews

* Cleanup after master merge

* Implement content hiding and placeholder states for reviews blocks

* Output product names and adjust css

* Review permalink

* Remove old read-more component which was moved

* showProductName is already part of passed attributes

* CSS tweaks for missing elements

* Move dir

* Move product reviews block

* Move shared uitils

* update paths

* frontend paths

* Update paths

* shared attributes

* switch to constants

* Shared review block code

* Replace constants

* Fix hidden content bug

* star alignment

* Update dependency eslint to v6.2.1 (#890)

* remove JSON parse

* remove comment

* No need for important rules

* Fix error appearing on Reviews by Product when there were no reviews (#884)

* Fix error appearing on Reviews by Product when there were no reviews

* Revert "Fix error appearing on Reviews by Product when there were no reviews"

This reverts commit 73e95b3.

* Move withProduct() HOC to editor-block.js

* Revert "Move withProduct() HOC to editor-block.js"

This reverts commit ae95157.

* Move renderNoReviews back to edit.js

* Move no reviews placeholder to its own component

* Remove usage of 'RawHTML'

* Fix propTypes

* Remove unnecessary escapeHTML

* revise labels

* Move component to base

* Add price text
mikejolley added a commit that referenced this pull request Nov 1, 2019
* Basic component setup

* Working slider

* Validation

* styling

* Update webpack config to fix ie11

* ie progress

* styling improvements

* improve events

* IE shim

* Fix samsung internet styles

* Add aria

* remove old methods

* event handling

* Tweak size and width of inputs

* reset progress

* shorthand notation for setstate

* Inline comment for textare usage

* Remove pointless comparison

* destruct from state

* zindex comment

* Move out currency settings and validation

* enforce int for min and max state

* Use woocommerce/settings

* showInputFields prop

* Filter Products by Price: Block creation (#865)

* Prevent interaction with slider

* Show input fields toggle

* Placeholder content and icons

* Update dependency rimraf to v2.7.0 (#858)

* placeholder styling

* remove unnecessary config (#862)

* Filter button and styling

* Show/hide placeholder based on product count

* Update dependency rimraf to v2.7.1 (#867)

* Use correct parameter order for implode. Solves deprecation notice in PHP 7.4 (#857)

* Add description to blocks added in last releases (#869)

* Limit max width

* Prevent wrap

* handles src file

* Introduce withCategory HOC for featured category block (#846)

* Introduce withCategory hoc

* Refactor featured category to use new hoc

* Update docblocks

* Add README note for PHP deprecation notices

* Remove screen-reader-text css rules (#849)

* Align stars left (#866)

* bool

* Create Reviews by Product block (#658)

* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (#671)

* Add label to Reviews by Product controls count (#677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (#688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (#693)

* Create Reviews by Product block placeholder (#691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (#696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (#702)

* Lint errors

* Replace stringify query with addQueryArgs (#707)

* Add reviews endpoint (#705)

* Prevent state updates on unmounted components (#715)

* Add Order by and Load more controls in Reviews by Product frontend (#716)

* Export IconReviewsByProduct (#721)

* Fix Reviews by Product layout in IE11 (#723)

* Set minimum to per page input field (#731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (#730)

* Blocks API - Reviews endpoint with rating sort and category filtering (#726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (#732)

* Add placeholder animation (#733)

* Hook up Reviews by Product 'Order by' with endpoint (#736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (#740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (#773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (#774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (#788)

* Fix import of WithComponentID

* Add new settings to Reviews by Product block (#787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (#811)

* Reviews by product: Update review styling and content (#806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (#820)

* Fix Reviews by Product order by select not honoring default setting (#818)

* Read more component - change how clamped content is shown (#821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (#826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (#828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (#830)

* Fix bundlesize config not picking frontend files (#840)

* Reviews by Product: split 'block.js' into smaller chunks (#841)

* Split 'block.js' into smaller chunks

* Move frontend blocks to their specific folder

* Order imports

* Typo

* Add frontend components proptypes

* Fix indentation

* Call 'this.getDefaultArgs' directly inside 'getReviews'

* Move access to wc_product_block_data to the top of the file

* Rename 'frontend' folder to 'base'

* Rename base components and move styles to their folder

* Fix Reviews by Product using rating count instead of review count (#860)

* Improve Reviews by Product accessibility (#861)

* Improve Reviews by Product accessibility

* Make 'onClick' prop not required in <LoadMoreButton>

* Wrap Reviews by Product editor block with <Disabled>

* Reviews: fix reviews without rating not appearing when sorting by rating (#863)

* Update assets/css/style.scss

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Pin dependencies (#872)

* Update dependency webpack to v4.39.2 (#855)

* Update dependency @woocommerce/components to v3.2.0 (#875)

* Update Reviews styles so it looks the same in the editor and the frontend (#871)

* Update Node.js to v10.16.3 (#874)

* Move wc_product_block_data variables to constants file (#870)

* Update dependency webpack-cli to v3.3.7 (#880)

* Add changelog script (#878)

* Add changelog script

* Adapt changelog script to WooCommerce Blocks

* Minor improvements

* Update dependency lint-staged to v9.2.3 (#879)

* Pin dependencies (#883)

* Update dependency eslint to v6.2.0 (#881)

* Reviews by category block (#804)

* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (#671)

* Add label to Reviews by Product controls count (#677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (#688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (#693)

* Create Reviews by Product block placeholder (#691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (#696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (#702)

* Lint errors

* Replace stringify query with addQueryArgs (#707)

* Add reviews endpoint (#705)

* Prevent state updates on unmounted components (#715)

* Add Order by and Load more controls in Reviews by Product frontend (#716)

* Export IconReviewsByProduct (#721)

* Fix Reviews by Product layout in IE11 (#723)

* Set minimum to per page input field (#731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (#730)

* Blocks API - Reviews endpoint with rating sort and category filtering (#726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (#732)

* Add placeholder animation (#733)

* Hook up Reviews by Product 'Order by' with endpoint (#736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (#740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (#773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (#774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (#788)

* Inital block setup

* Fix import of WithComponentID

* Render the category reviews

* Add new settings to Reviews by Product block (#787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (#811)

* Reviews by product: Update review styling and content (#806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (#820)

* Fix Reviews by Product order by select not honoring default setting (#818)

* Read more component - change how clamped content is shown (#821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (#826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (#828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (#830)

* Update based on product reviews

* Cleanup after master merge

* Implement content hiding and placeholder states for reviews blocks

* Output product names and adjust css

* Review permalink

* Remove old read-more component which was moved

* showProductName is already part of passed attributes

* CSS tweaks for missing elements

* Move dir

* Move product reviews block

* Move shared uitils

* update paths

* frontend paths

* Update paths

* shared attributes

* switch to constants

* Shared review block code

* Replace constants

* Fix hidden content bug

* star alignment

* Update dependency eslint to v6.2.1 (#890)

* remove JSON parse

* remove comment

* No need for important rules

* Fix error appearing on Reviews by Product when there were no reviews (#884)

* Fix error appearing on Reviews by Product when there were no reviews

* Revert "Fix error appearing on Reviews by Product when there were no reviews"

This reverts commit 73e95b3.

* Move withProduct() HOC to editor-block.js

* Revert "Move withProduct() HOC to editor-block.js"

This reverts commit ae95157.

* Move renderNoReviews back to edit.js

* Move no reviews placeholder to its own component

* Remove usage of 'RawHTML'

* Fix propTypes

* Remove unnecessary escapeHTML

* revise labels

* Move component to base

* Add price text

* Update design to latest figma

* update from master

* Fixed merge conflicts with settings

* Fix formatting

* Update to use react hooks

* Progress hooking up price slider

* Fixes usage of data store for min/max

* Added loading state

* Fix useQueryStateByKey setter

* Product list integration

* Inital state and preventing too many queries

* Style fixes

* Button loading styles

* Package conflict

* useCallback

* Remove duplication

* variable name feedback

* Implement useCallback on functions

* useMemo for getProgressStyle

* Block feedback

* Use get_block_asset_build_path

* Remove old settings from merge conflict

* Move sketch file to .prefixed dir

* Removed render methods

* Exclude price filter from legacy build

* Feedback
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: accessibility The issue/PR is related to accessibility. skip-changelog PRs that you don't want to appear in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants