Hello Team,
How are you doing?
I wanted to understand how do I setup alt text and aria-labels for category images?
Regards
~Vikash
In a discussion titled “A11y for Categories” under the Support category and tagged with accessibility, ivikash asked how to set up alt text and aria-labels for category images. awesomerobot responded that currently there’s no built-in option to add aria-labels or meaningful alt text, and advised against using category images for anything beyond decoration since screen readers currently announce them as just “graphic.” They noted that while adding aria-labels via theme settings is technically possible, it requires familiarity with Discourse theme development. As a temporary fix, they implemented an empty alt attribute to ensure screen readers ignore the images entirely, which was merged in pull request #12830 awesomerobot. ivikash followed up asking whether the image title could be used as alt text, suggesting a potential alternative for accessibility improvement.
Hello Team,
How are you doing?
I wanted to understand how do I setup alt text and aria-labels for category images?
Regards
~Vikash
There’s no option to add the aria-labels to the images, so it’s not a good idea to use these images for anything other than decoration.
The way the images are marked up now, it seems like a screen reader would say “graphic” and nothing more. We don’t have any current plans to add the option to setup alt text, but we should probably include that as an option in our image uploader at some point.
In the meantime we should add an empty alt tag there so it’s ignored completely instead of the unhelpful state it’s currently in.
It would be possible to add aria-labels to the markup using theme settings in a theme component, but it would be difficult if you’re unfamiliar with building Discourse themes (Developing Discourse Themes & Theme Components).
I’ve merged in the empty alt tag fix
Thanks Chris. Could we have used Image title as alt text?