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

axis ariaDescription #725

Merged
merged 1 commit into from
Jan 30, 2022
Merged

axis ariaDescription #725

merged 1 commit into from
Jan 30, 2022

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Jan 29, 2022

This…

  • Consolidates code for setting the aria-label and aria-description of an axis
  • Allows the user to specify a custom aria-description, while retaining the default aria-label
  • By default, uses the (visible) scale label as the aria-description rather than the aria-label

I know it’s tempting to put the scale label in the aria-label of the axis because they’re both “labels”, but the current default axis label (e.g., “x-axis”) is a better label than the scale label which in Plot indicates only the abstract dimension of data, i.e. the input, not the output visual channel such as x or y. And if we try to combine the scale label into the axis label, then we have to separate them somehow (e.g., with a comma “x-axis, Date →” or with parens “x-axis (Date)”, though the latter won’t work well since we already use parens for percentages etc.). And then the user can’t set one without affecting the other.

I believe we are supposed to use aria-describedby here, but I would prefer to avoid a random/incrementing id, so I’m hoping that using aria-description will be equivalent. We could switch to aria-describedby if necessary.

@mbostock mbostock requested a review from Fil January 29, 2022 17:06
@Fil
Copy link
Contributor

Fil commented Jan 29, 2022

It's getting better :)

It looks like aria-description is fairly recent and not well supported at the moment (https://html5accessibility.com/stuff/2021/02/09/aria-description-by-public-demand-and-to-thunderous-applause/ ; https://caniuse.com/?search=aria-description). I haven't been able to get assistive tools to say the aria-description. In the meantime, the aria-label works well ((and everywhere https://caniuse.com/?search=aria-label).

@mbostock
Copy link
Member Author

Well, I’m all for being forward-looking and embracing aria-description. Being forward-looking has worked out well for me in the past. 😁

@Fil
Copy link
Contributor

Fil commented Jan 30, 2022

I've opened a test account on https://assistivlabs.com/ and tried with NVDA and Narrator, without much success either. But I think that this is going in the right direction, and that independently of what assistive tools already offer or not, we can build on these elements (for example, a script that would add a keyboard navigation/tooltip behavior).

@Fil Fil merged commit e707812 into fil/aria-ff Jan 30, 2022
@Fil Fil deleted the mbostock/aria-ff branch January 30, 2022 16:54
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.

2 participants