? ?
avatar brianteeman
brianteeman
19 Jan 2020

This is to aggregate two separate issues that have the same base

1. Image field

This field needs the ability to set an ALT attribute. This is essential for accessibility

2. Url field

This field needs the ability to set the value to be displayed for the link. For example it would be better to display a url as joomla news than https://www.joomla.org/announcements/release-news/5781-joomla-3-9-14.html

avatar brianteeman brianteeman - open - 19 Jan 2020
avatar joomla-cms-bot joomla-cms-bot - change - 19 Jan 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 19 Jan 2020
avatar brianteeman brianteeman - change - 19 Jan 2020
Labels Added: ? ?
avatar brianteeman brianteeman - labeled - 19 Jan 2020
avatar brianteeman brianteeman - labeled - 19 Jan 2020
avatar Bakual
Bakual - comment - 19 Jan 2020

We could specify additional parameters (like "alt" or "display value" when creating the field. That would be the same in each item (eg article) where that field appears.
But I don't think that is what you want?

If you expect the user who fills the value for the field to also specify the ALT text or the display value, then that will not be possible. Simply because you expect one field to generate two fields (eg src and alt for the image). You'd have to create two fields for that and use them properly in your override, which is already possible today.

avatar chmst
chmst - comment - 19 Jan 2020

I fond this issue two years ago, but als @Bakual says, it is not possible without changing the database and the whole output of the fields.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27571.

avatar brianteeman
brianteeman - comment - 20 Jan 2020

You can say it's not possible but it must be fixed or everything said about accessibility with j4 is invalid

avatar Bakual
Bakual - comment - 20 Jan 2020

You would have to change the whole architecture of com_fields to allow that. And by doing that, you will break the fields as the whole code is meant to process a single input per field. I'd be strongly against that.

Those are custom fields. This has nothing to do with our accessibility promise for J4. It's user generated content and thus out of our control.

If you need a field for the ALT attribute, nothing stops you from creating that field to accompany the image field (which is in fact just an file selector field). You just need to set up everything you need yourself, it's not done automatically.

avatar Fedik
Fedik - comment - 20 Jan 2020

or store value as JSON {"src":"blabla/path/to-image.jpg", "alt":"random text"}
but that also not best and easy :)

avatar brianteeman
brianteeman - comment - 21 Jan 2020

For the URL field I have already written the code

avatar laoneo
laoneo - comment - 21 Jan 2020

@Fedik having it as json makes it harder to index and search.

avatar brianteeman
brianteeman - comment - 21 Jan 2020
  1. its an image so I doubt we would ever have indexed it
  2. subfields are already stored as json
avatar Fedik
Fedik - comment - 21 Jan 2020

@laoneo no, not really make a difference, the finder doing indexing of the "final render", will be indexed what is rendered ?

avatar laoneo
laoneo - comment - 21 Jan 2020

Are you sure? Anyway, simething tells me that we will run into some issues. But on the otherside it would be nice to have a display value. Un general it would be cool if we can break up fields that way.

avatar Fedik
Fedik - comment - 21 Jan 2020

@laoneo check the finder plugin onContentAfterSave and index(), it uses the same onContentPrepare stuff, so if the field are rendered at onContentPrepare then it will be indexed with the article text.

Anyway, simething tells me that we will run into some issues

I did not said that it is a perfect solution, just an idea

avatar astridx
astridx - comment - 21 Jan 2020

@brianteeman For the URL field I have already written the code

Did you create a PR for this?

avatar astridx
astridx - comment - 21 Jan 2020

For the media field: At the moment it is the case that no alt-tag for the media field is output in the markup.
Perhaps we could insert a text field in the custom field in which an alt-text can be inserted for all images for this Custom Fields together.

Articles  Edit Field   Test   Administration

In my opinion it is usually the case that the pictures explain a certain aspect. So it is possible to formulate the text so, that is fits.

Of course, it's not that it's the best solution for adding an alt tag. But it is a compromise.In any case, the formal criteria are met.

avatar brianteeman
brianteeman - comment - 23 Jan 2020

@astridx I submitted the PR for the url field yesterday #27597

avatar astridx
astridx - comment - 23 Jan 2020

What do you think of it when we generate the alt text from the file name? For example, an image file with the name Aerial_view_of_Central_Park_in_New_York.jpg receives the alt text Aerial view of Central Park in New York.

avatar brianteeman
brianteeman - comment - 23 Jan 2020

@astridx that is not a solution. we can and must do better than that

avatar astridx
astridx - comment - 23 Jan 2020

The layout and the field are used in several places.

If you insert a text field here, this will also be shown when creating an article.
When creating an article, there is already a text field in which an alternative text can be entered.
Articles  Edit   test   Administration

Shall we create a new field (that inherits from the media field) and layout for the custom field?

avatar brianteeman
brianteeman - comment - 24 Jan 2020

However it is done when a user adds an image field it should include an ALT attribute input. It cannot be something they have to add as a separate field

avatar brianteeman brianteeman - close - 26 Jan 2020
avatar brianteeman
brianteeman - comment - 26 Jan 2020

closed as we now have a good draft pr for the media field

avatar brianteeman brianteeman - change - 26 Jan 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-01-26 18:06:55
Closed_By brianteeman
Labels Added: ?
Removed: ?
avatar wilsonge wilsonge - change - 19 Mar 2020
Labels Added: ?
Removed: ? ?
avatar wilsonge wilsonge - unlabeled - 19 Mar 2020

Add a Comment

Login with GitHub to post a comment