Skip to content

script to generate title tags and attributes from filenames to help with accessibility#199

Open
Willjfield wants to merge 2 commits into
waysidemapping:mainfrom
Willjfield:main
Open

script to generate title tags and attributes from filenames to help with accessibility#199
Willjfield wants to merge 2 commits into
waysidemapping:mainfrom
Willjfield:main

Conversation

@Willjfield
Copy link
Copy Markdown

Hey @quincylvania ! I've been delving into web accessibility issues and what can be done on maps.

One thing I learned was that SVGs can have the equivalent of alt text to help with screen readers. Here's an article with a few ways to do it. Fortunately, the filenames themselves are already good descriptors so I made a script that automatically implements pattern 7 from that link. I don't think there's a way to carry these over into fonts and it's entirely possible people will rasterize them or use them in ways that discard these attributes but I think this would be a good step in the right direction. I didn't incorporate the script into the rest of the build pipeline but presumably it could be called from build_dist.js (or anywhere else) as needed.

I ran the script so all the current icons now have these attributes. Let me know what you think.

@quincylvania
Copy link
Copy Markdown
Contributor

Hey thanks for working on this! I am a little hesitant to put this text in all the icons directly since it's English-only and some consumers may want to prioritize their own titles. Like, in some environments you'd want the screen reader to say "courthouse" or "lawyer" instead of "balance scales" depending on context. What do you think about adding this type of functionality into the JS API (#105).

@Willjfield
Copy link
Copy Markdown
Author

I think adding it to the JS API is a good idea so I'll work on that. I think in a lot of cases, the file name works well but then you're right that people may want to edit a few individually or translate them. What if the script creates a json file with [{"filename":"eg.svg", "description":"An example icon"},...] and then a second step applies the json to the icons? So if you wanted to edit an individual icon's description you'd go into the json file before applying it.

Would it be better to work off this pr or start a new one?

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