New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/37601 Add aria-describedby
to Select options button
#37880
Conversation
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.
Hi @faisal-alvi!
Thanks for your contribution 💯. I tested and while this works when the default "Select options" string is used, it doesn't really work if that string changes (for example, when translated).
I left some comments on how to possibly fix that, as well as some general (though easily solved) feedback.
Please let me know what you think. Looking forward to hearing back from you.
'rel' => 'nofollow', | ||
), | ||
); | ||
|
||
$args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product ); | ||
|
||
if ( isset( $args['attributes']['aria-describedby'] ) && ! empty( $args['attributes']['aria-describedby'] ) ) { |
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.
There's no need to check that the key is set with isset()
. empty()
already takes care of that.
@jorgeatorres thanks for the feedback. The suggestions/changes are implemented. Please check 99b5c7e and let me know if any changes are required. |
Hi , Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
70177d1
to
98d2fb9
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #37880 +/- ##
==========================================
- Coverage 51.5% 51.5% -0.0%
- Complexity 17281 17443 +162
==========================================
Files 430 440 +10
Lines 80030 80290 +260
==========================================
+ Hits 41217 41346 +129
- Misses 38813 38944 +131
|
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.
LGTM. Thank you @faisal-alvi!
(I just made a tiny change to address a PHPCS issue, but other than that, it looked good)
Submission Review Guidelines:
Changes proposed in this Pull Request:
aria-describedby
description for the add to cart button.Closes #37601.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
aria-describedby
attribute is added with the value:"This product has multiple variants. The options may be chosen on the product page"
.