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

Add aria-expanded and aria-control attribbutes to gift card checkbox #2458

Closed
wants to merge 1 commit into from

Conversation

antiBaconMachine
Copy link
Contributor

PR Summary:

Add aria-expanded and aria-control attribbutes to gift card checkbox

Why are these changes introduced?

The intent here is to give context to screen readers that the gift card recipient form is being hidden and shown.

What approach did you take?

I'm using the example here https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/ as a reference but I'm not getting great results from mac voiceover. Android talkback is better, when I highlight the checkbox it correctly announces the collapsed/expanded state. It does seem that voiceover is lacking in support for aria-expanded.

Other considerations

I should note that it is only the checkbox that gets the state not the label which would be more commonly selected as it's bigger. I think this is a good first step to solving this issue, though we may want to do more.

Decision log

# Decision Alternatives Rationale Downsides
1

Visual impact on existing themes

None

Testing steps/scenarios

Activate your preferred screenreader and listen to the results as you toggle the checkbox on and off.

Demo links

Checklist

The intent here is to give context to screen readers that the gift card recipient form is being hidden and shown. I'm using the example here https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/ as a reference but I'm not getting great results from mac voiceover. Android talkback is better, when I highlight the checkbox it correctly announces the collapsed/expanded state.

I should note that it is only the checkbox that gets the state not the label which would be more commonly selected as it's bigger. I think this is a good first step to solving this issue, though we may want to do more.
@@ -23,6 +23,8 @@
name="{{ gift_card_recipient_control_flag }}"
disabled
unchecked
aria-expanded="false"
Copy link
Contributor

@metamoni metamoni Mar 24, 2023

Choose a reason for hiding this comment

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

I think this isn't working as you'd expect because it's missing a role. aria-expanded works with the following associated roles. A button, for example, has an implicit role, so you wouldn't need to add one. But for an element without an implicit role, such as a div or input, the screen reader will require more context to understand what the widget does. The combobox role would probably be a good fit for this.

I'm not super familiar with this area, but I'd be happy to take a look at it myself if you add some detailed testing steps (some simple instructions on how to get to this screen/checkbox would be helpful). Feel free to reach out if you'd like to pair too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is how you'd go about testing the feature/fix: video

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, @ludoboludo. @antiBaconMachine and I have discussed this, as well as potential solutions. Here's a summary:

  • we both agreed that a checkbox might not be the best element to use here
  • I suggested changing the element to a button and using one of the following patterns: an accordion or a disclosure (which we use in the drawer menu)
  • I suggested checking with UX to find a good pattern and adjust the design if needed

Copy link
Contributor

Choose a reason for hiding this comment

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

Sweet, thanks for the update 🙂

@antiBaconMachine
Copy link
Contributor Author

Thanks for the helpful feedback @metamoni. I've read around a bit more and if I understand correctly a checkbox is not a supported role for aria-expanded. As you pointed out we could perhaps use one of the approved roles. I'm not convinced combobox is the right role, I would have very specific expectations of how a combobox would work, i.e. a select box that also allows free text. Possibly we could just use something generic like button, but that doesn't seem right either.

Why is checkbox not a supported role for aria-expanded? I'm not sure, there is this mailing list question https://lists.w3.org/Archives/Public/public-aria/2016Feb/0066.html but to my eye there isn't a definitive answer in there.

In terms of testing this product can be used https://transmogriphy.myshopify.com/products/gift-card. The checkbox in question is the one labelled I want to send this as a gift

@bakura10
Copy link

bakura10 commented Apr 7, 2023

I am facing some issues here as well. What about creating an aria-owns relationship between the checkbox input and the div that owns the content? I think the checkbox is the right element here for holding the decision :).

@fredma
Copy link
Contributor

fredma commented Jun 28, 2023

Superseded by #2672

@fredma fredma closed this Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants