jordibruin / Swift-Charts-Examples

An overview of the different types of charts you can make with Swift Charts
MIT License
1.95k stars 126 forks source link

Make all charts accessible #24

Open jordibruin opened 2 years ago

jordibruin commented 2 years ago

Adding simple accessibility labels and values goes a long way in making it the standard for people when they use these charts as examples.

Please add these to your sample charts: .accessibilityLabel("(element.ageRange)") .accessibilityValue("(element.percentage)")

mathewa6 commented 2 years ago

I've started working on this in PR #28. As I bring up in the PR, do we think it's worth differentiating between the accessibility of the simple and detail charts in this repo?

i.e in a real app - it doesn't make sense to have VoiceOver users traverse all data points when the chart is in a cell. So for this repo the 2 options are :

jordibruin commented 2 years ago

I would say let’s go for the second option there!

mathewa6 commented 2 years ago

Awesome thanks for the direction- I'm on it!

Just a heads up though - it would seem that labels and values are ignored in the current seed. This captioned video shows the current 2 bar layout in the main branch that was created with label/value but it still defaults to the inferred/internal label.

If anyone wants to verify this behavior, I can file some feedback.

EDIT: This seems to occur in Accessibility Inspector as well - replace the dynamic label/value in TwoBarsSimpleDetailView with a string literal still shows the inferred labels. If it's working for anyone, do let me know

EDIT 2: This is an iOS 16 issue force rebooting the device fixes it!

https://user-images.githubusercontent.com/5402357/173678430-635ae2f1-a310-4d05-b549-42a7e2716894.mov

jordibruin commented 2 years ago

The descriptions in that video are not great yet. We’ll have to figure out how to say the correct thing! 🤔

I’ll look at Apple’s example soon but there they say something like: Monday, Cupertino sales 150, San Jose sales 120

mathewa6 commented 2 years ago

Oh I agree - the video is the issue I referred to above and those are the inferred default system labels. If you can reproduce, try restarting the device. However it does seem to recur.

I believe the labels we set for each bar does state the city, sales closer to your example 🙂