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

Improvements to accessibility features #38

Closed
tysongach opened this issue Jun 5, 2016 · 2 comments
Closed

Improvements to accessibility features #38

tysongach opened this issue Jun 5, 2016 · 2 comments

Comments

@tysongach
Copy link

I was super happy to find out about the new accessibility features introduced! Thank you for that.

One thing I noticed is that when enabling these a11y features, the output of the title and desc elements do not have ID’s associated with them, which the aria-labelledby attribute expects.

I find the SitePoint article that was referenced a bit confusing here, because they do give these element ID’s, but the name of the ID’s are also the name of the elements themselves:

<svg aria-labelledby="title desc">
  <title id="title">Green rectangle</title>
  <desc id="desc">…</desc>

Not only is that hard to follow, there’s also a problem in that these ID’s are super generic and are in high risk of accidentally colliding with a duplicate ID somewhere else on the page. And we all know that ID’s need to be unique. Maybe an example like the following would be a bit more clear:

<svg aria-labelledby="green-rectangle-title green-rectangle-desc">
  <title id="green-rectangle-title">Green rectangle</title>
  <desc id="green-rectangle-desc">…</desc>

Ultimately what I’m getting at here is that inline_svg is currently referencing the title and desc elements, instead of ID’s:

<svg role="img" aria-labelledby="title desc">
  <title>Blog home</title>
  <desc id="desc">…</desc>

Making the ID’s unique is the interesting part; maybe a simple hash could help here?

@jamesmartin
Copy link
Owner

Making the ID’s unique is the interesting part; maybe a simple hash could help here?

@tysongach I like this idea. Assuming the hash is based on the title and some other "salt" value, it should be unique enough for most cases.

@jamesmartin
Copy link
Owner

Fixed in v0.9.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants