-
Notifications
You must be signed in to change notification settings - Fork 71
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
Unique IDs for a11y Elements #39
Conversation
Actually, thinking about it a bit more. SHA1 is going to be unsuitable for an ID because it can generate garbage like this:
I don't think we want that as an ID. Might have to switch to a random alpha/numeric generator. |
Worked around the SHA1 byte-garbage problem by hexencoding the bytes, converting to a base16 fixnum and then working back to base36 to get a-zA-Z0-9. Should be fine. |
Sounds great! Mind posting an example input/output? |
@tysongach here's an example from my test rails app: %h2 SVG With Accessibility Labels (Aria)
.svg
= inline_svg('iconmonstr-glasses-12-icon.svg', class: 'medium-blue', title: 'An SVG', desc: 'This is my SVG. There are many like it. You get the picture', aria: true) What do you think? |
@jamesmartin I think this is great! |
Addresses #38. Generates a simple SHA1 hash of the title and description element's ID attributes to ensure uniqueness when adding the
aria-labelled-by
attribute to the SVG root node./cc @tysongach is this what you had in mind?