-
-
Notifications
You must be signed in to change notification settings - Fork 697
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 screen reader support using aria-label attribute #137
Conversation
This changeset modifies `hint-core.scss` to use `aria-label` as its source so that the tooltip content can be read by screen-readers. This pattern is used in GitHub's "Primer" framework (see http://primercss.io/tooltips/) Doing so required all base styles to be applied to the `hint--`-prefixed classes, since `data-hint` is no longer used. To test these changes I modified `demo.html` to use the new `aria-label` pattern, then modified the "bottom-right" demo button so that its tooltip read off "Hello, world." I confirmed that the sentence was read off by a screen-reader (VoiceOver in Safari, as well as ChromeVox in chrome). These changes come with the assumption that tooltips are in fact a label for the element they are annotating - meaning that the contents of the element will be skipped over by the screen-reader in favor of the tooltip's contents. If the tooltips are primarily used to annotate icons, this is perfectly acceptable.
Populate tooltip content using the aria-label attribute
I tested it and I think this PR is great. I would suggest mentioning |
@tfoxy Yeah. Will update the docs. |
@chinchang Do you know if this will make it into the next release / when that will be!? This really would be a great feature to have! |
@rossholdway I am working on the final changes for this to get merged into master. This will be live in the coming release this weekend. |
} | ||
// If the `data-hint` attribute is present, use it. | ||
// This might be deprecated in future in support of a11y. | ||
&[data-hint]:after { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool trick @tfoxy @chinchang :)
ca9aaed
to
9317acf
Compare
Merging into dev. |
Carrying forward @jdan original PR #128 to support screen reader a11y by using
aria-label
attribute.Copy from #128:
This PR now puts in default support for
aria-label
attribute to define tooltip content along with the currently supporteddata-hint
attribute. So any of the attributes will work.Opening this PR against
dev
where I can finally work on the related docs and examples for this to get ready formaster
.Note: Ignore the CSS files in the diff :)