adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
723 stars 737 forks source link

[Image v3] Add a lang attribute on image that contain text in foreign language #2728

Open renow-luxembourg opened 2 months ago

renow-luxembourg commented 2 months ago

Feature Request

Current Behavior : Some informative image contain text in foreign language. If we follow the WCAG/RGAA/RAWeb1 rules, the alternative text should contain at least the visible texte of the informative image. But for the moment, in the image component, we can't define a language for the alternative text. This aims to cause that the image alternative is not well rendered to assistive tool (like the NVDA screen reader)

Expected behavior/code : We should be able to add a lang attribute for each image.

Environment

Possible Solution : Add a lang attribute on the 'img' tag based on the language defined in the "advanced" tab of the asset property

Additional context : WCAG 2.1 : Technique H37 (https://www.w3.org/WAI/WCAG21/Techniques/html/H37) WCAG 2.1 : 3.1.2 Language of Parts (https://www.w3.org/WAI/WCAG21/Understanding/language-of-parts) WCAG 2.1 : Technique H58 (https://www.w3.org/WAI/WCAG21/Techniques/html/H58) RGAA 4.1.2 / RAWeb 1 : 8.7.1 https://accessibilite.public.lu/fr/raweb1/criteres.html#test-8-7-1 (in french) RGAA 4.1.2 / RAWeb 1 : 1.1.1 https://accessibilite.public.lu/fr/raweb1/criteres.html#test-1-1-1 (in french)

renow-luxembourg commented 1 month ago

What I would like to achieve: 1) Get the content of ./jcr:content/metadata/dc:language from the Image DAM properties 2) Compare this value with the current page language 3) If value are different, add a lang attribut on the img tag

What do you think of the following contribution? https://github.com/adobe/aem-core-wcm-components/compare/main...renow-luxembourg:aem-core-wcm-components:renow_fix_img_lang