plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
267 stars 194 forks source link

alt-tags are not aggregated consistently #3530

Open mikey00001 opened 2 years ago

mikey00001 commented 2 years ago

Images have an alt-tag (which contains the text alternative for the image), which is generated inconsistently, depending on how an image is inserted and which fields are used and/or available.

Proposal 1: every image object should have a field "text alternative", which is not context-dependent. The field should be a property of the image and not of the context in which the image is used.

Proposal 2: the field should be renamed from "alternative text" to "text alternative" because semantically the former name suggests that the text is an alternative to another text, which it is not. It is an alternative to the image.

This differenciates the field "text alternative" from the "caption"-fields, which can be context dependent: an image can be used in multiple contexts with different captions. This is not true for the text alternative because the purpose of the text alternative is to neutrally describe the contents of the image.

If the text alternative field is empty, there should be a consistent and transparent fallback. The fallback rules need to be documented and readily accessible for the users. Here is a list of some permutations / examples and the inconsistent behaviors they currently produce:

image type image is embedded in rich text (content-type: page) text is typed into image-title during insertion of image text is typed into field "alternative text" during insertion of image text is typed into field "image caption" during insertion of image field from which text alternative is generated
plone image object no - - - title (in image object)
plone image object (in parent) no - - - title (in image object)
plone image object yes no no no summary (in image object)
plone image object yes yes no no summary (in image object)
plone image object yes no yes no alternative text
plone image object yes yes yes no alternative text
plone image object yes no no yes summary (in image object)
plone image object yes yes no yes summary (in image object)
plone image object yes no yes yes alternative text
plone image object yes yes yes yes alternative text
lead image without lead image caption (in page) - - - - title (in page)
lead image with lead image caption (in page) - - - - title (in page)
lead image without lead image caption (in parent of page) - - - - title (in page)
lead image without lead image caption (in parent of page) - - - - title (in page)
slider image - - - - summary (in image object)
gogobd commented 2 years ago

Thanks for submitting!

MrTango commented 2 years ago

Thx for bringing this up. Please be aware that in most cases you should not autogenerate the text for an alt-tag. The corrent text of an alt-tag is highly dependend of the context and surounding infos like caption, a headline and so on. https://webaim.org/techniques/alttext/

In Plone 6 classic ui the default behavior has changed to not autogenerate alt-text in output filter. The user has to set it or it will be empty, which can be the right choice depending on the context.

But in some cases, meanly listings, a fallback alt-text stored on the image object could be useful.

Maybe let's add this via add-on?