This is a follow up issues to #1553094: Alt and Title support for Images about pre-populating the alt/title configuration for the Image file type in File Entity with the tokens from the default alt and title fields..

  1. The above patch creates to fields, in the Manage Fields tab, for the Image file type allowing users to enter texts for the "alt" and "title" attributes. However, by default the texts entered in those field are not used in any other way than they are stored in the database and viewable in the content admin interfaces.
  2. The patch is also adding two fields, in the Manage Displays tab, where it is possible to configure from where Drupal will populate the alt/title attributes for images. These are blank by default and thus no text is placed in the output of those attributes.

By default they should be populated with the field tokens from 1 so they work without the need of any additional configuration required. The majority of sites will most likely use the defaults, thus this would avoid them some pain in having to find out why this is not working out-of-the-box.

I have set status to postponed for now as the above mentioned patch needs to be committed first.


mgifford’s picture

Quite hopeful that we can see some means to help the process of creating meaningful alt text & titles, but have some concerns as originally stated here - #1553094-91: Alt and Title support for Images

Mostly it boils down to how to make them meaningful as per:

mgifford’s picture

Issue tags: +Usability, +accessibility
tsvenson’s picture

I understand your concerns. However, these fields are empty and unless someone types something into them, nothing will be outputted if these tokens would prepopulate the display formatter, just the standard required 'alt="" title=""'.

mgifford’s picture

I'd much prefer an empty alt text to one that just clutters up things for a screen reader. Some good examples of bat alt tags here:

It's too easy for auto generated alt text to produce something that is less than meaningful.

Good alt text requires some thought I think:

But let's talk about what tokens could be used here. Title is an obvious one. Maybe metatags.

Not sure if there's an option for more than one image. Could be a way to put in some helper text to try to make it easier and also useful based on to tokens.

tsvenson’s picture

It would probably be a good idea to include a link to the w3c page that explains what the alt/title attributes is for on the config page.

The tokens I propose should be used to prepopulate the display formatter will not have any autogenerated text. They are simply copying the values entered in the two input fields for the image added by #1553094: Alt and Title support for Images.

Then we need t put the responsibility on the site developers/owners to give those that will be able to edit those field the right guidelines about what to enter in them.

For me the patch actually adds an un-completed feature as it is not doing anything unless the sitebuilder manually adds those tokens to where they should be from the beginning.

mgifford’s picture

I have to acknowledge not having time to dig into this patch and verify how it is actually working. Maybe I've misunderstood things.

Alt is for accessibility. Title is usually only there to have a tooltip on mouseover so that sighted users can get additional context.

There are problems on Assistive Technology (AT) devices interpret text. Some can do both, but most ignore the title attribute as I understand it. At worse the AT will read both and they will be identical.

Took a quick look for a good resource but didn't find one easily.

RobW’s picture

@mgifford, from what I understand/ has been explained to me, this issue is about setting the alt field as the default alt text in the formatter. The tokens are the bridge between any token provider/ field to the formatter. So if the default formatter token is the file entity "alt field", a user could add whatever they like there when editing the file entity, or leave it blank.

mgifford’s picture

Is there a distro or maybe just a sandbox site up there to look at?

There's just a lot of set up work that would be necessary to wrap my head around what's being discussed here.

Maybe it will be more clear after the other patch is brought into the module.

Berdir’s picture

Status: Postponed » Closed (duplicate)

Closing this, this was trivial and I added it to the original patch when I did a re-roll.

@mgifford: Accessibility is not a problem here. This is *not* about prepopulating actual titles/alt values. It's about prepopulating the alt/title *configuration* fields with a token that allows to use the user-provided alt and title values (which are standard textfields) from the stored image entity. So users have 100% control over alt/title fields and if there is no user-provided value, no title is displayed.

tsvenson’s picture

@Berdir: Thanks so much, again you rise up and become my Drupal hero :)

mgifford’s picture

Thanks for the clarification @Berdir.