Skip to content
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

Accessibility: Reset variations "Clear" button on product single incorrectly coded as a link #43609

Open
5 tasks done
amberhinds opened this issue Jan 14, 2024 · 2 comments
Open
5 tasks done
Labels
focus: accessibility The issue/PR is related to accessibility. focus: shop Issues related to shop page. team: Kirigami & Origami type: community contribution

Comments

@amberhinds
Copy link

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

The reset variations button is coded as a link when it should be a button. This is the current code:
<a class="reset_variations" href="#" style="visibility: visible;">Clear</a>

Links take people to a new page or a new part of a page. Buttons perform actions on a page. Because this clears the selections in the product variation inputs, this should be a button and not a link.

This either needs to be re-coded using a button tag, or it needs role="button" added to it and JavaScript written to add keyboard handlers for the Space Bar.

Expected behavior

The clear button should be coded as a button and not a link.

Actual behavior

The button is coded as a link, as show here:
https://github.com/woocommerce/woocommerce/blob/758df4854d7b627fc26eb5c0860dc492dea6a06e/plugins/woocommerce/templates/single-product/add-to-cart/variable.php#L48shown

Steps to reproduce

See code linked above.

WordPress Environment

N/A

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.
@adimoldovan adimoldovan added focus: accessibility The issue/PR is related to accessibility. team: Mothra focus: shop Issues related to shop page. status: awaiting triage This is a newly created issue waiting for triage. team: Kirigami & Origami and removed team: Mothra status: awaiting triage This is a newly created issue waiting for triage. labels Jan 15, 2024
@dinhtungdu
Copy link
Member

role="button" sounds the best balanced and safe approach to me. Thank you Amber for the report! I added this to our backlog.

@amberhinds
Copy link
Author

Thanks. If you go with adding role="button", don't forget to had the key handlers so it functions as a button. See the ARIA button role on MDN web docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: accessibility The issue/PR is related to accessibility. focus: shop Issues related to shop page. team: Kirigami & Origami type: community contribution
Projects
None yet
Development

No branches or pull requests

3 participants