Accessibility Improvements – Dynamic Alt Text
Map is getting flagged for accessibility issues – namely around labelling for the map and individual area elements.
https://www.w3.org/WAI/tutorials/images/imagemap/
For image maps, text alternatives are needed on both the
element itself (to convey the informative context) and on each of the elements (to convey the link destination or the action that will be initiated if the link is followed).
Currently, the img element and all area elements are hardcoded with the alt text "map". I'd like to be able to pass in more descriptive alt text for each.
Is it possible to add this functionality?
Not right now, but will be in the new version
Resolved in V2.0.0-alpha.8 release, please check imgProps/areaProps
I'm unable to see how the alt text can be edited - currently I'm still seeing alt="map" hardcoded in the source code. Could you give me further instruction? Thank you!
You can see imgProps is spread in the code, so alt will be replaced by the code if you will add that in the imgProps
https://github.com/img-mapper/react-img-mapper/blob/master/src/ImageMapper.tsx#L303
Appreciate the response! That works great for setting a custom img alt, but I'm still unable to assign alt text to each area - ideally this would be set per area in the same way that I can set coords or ids. It looks like I can only pass a single alt text string via areaProps that is used across all areas - is there another approach?