Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alt Text field for apostrophe-images #1661

Closed
plantainrain opened this issue Oct 4, 2018 · 25 comments
Closed

Alt Text field for apostrophe-images #1661

plantainrain opened this issue Oct 4, 2018 · 25 comments
Labels
enhancement v3 Related to Apostrophe 3

Comments

@plantainrain
Copy link
Collaborator

plantainrain commented Oct 4, 2018

Create a new dedicated field for alt text for apostrophe-images. Currently the title or description field is being used for alt text, but improving the the schema to include a dedicated field for alt text would be good, as well as adding explicit help text to each field. To avoid any sort of BC break and confusion on previous implementations of these fields, we can create a feature flag (an option passed to the apostrophe-images module) that would activate these new fields.

Alt text would be made available the same way other image fields are here:

if (o.credit) {
value._credit = o.credit;
}
if (o.creditUrl) {
value._creditUrl = o.creditUrl;
}
if (o.description) {
value._description = o.description;
}
if (o.title) {
value._title = o.title;
}

screen shot 2018-10-04 at 3 31 05 pm

@abea
Copy link
Contributor

abea commented Oct 4, 2018

@bgantick made the point that help text for the legacy fields might not always be the same. I think I'd be in favor of being somewhat opinionated with those, at least "description"--possibly simply renaming that to "caption." People can still use them for various purposes, but the intent will be clearer.

@abea abea removed their assignment Oct 4, 2018
@fredrikekelund
Copy link
Contributor

Report from the wild: we're using the description property to render alt attributes for images in our projects

@abea
Copy link
Contributor

abea commented Oct 5, 2018

That's fairly common here as well, @fredrikekelund, and you raise a good point of clarification. The problem I think @mtthwmnc is looking to solve is that it's not clear in the user interface which field is to be used for the alt text. Not really clear to the developers as well. So at P'unk we've ended up with a mix of projects using the description field, the title field, and a few using project-specific alt-text fields.

In 3.x I think this is going to be cleared up, but this suggestion would help clear things up without breaking old projects. We should discuss the best way to do that, however.

@boutell
Copy link
Member

boutell commented Oct 5, 2018 via email

@abea
Copy link
Contributor

abea commented Oct 5, 2018

Since the default right now for apos-images-widget is to use title for the alt attribute, I agree with what (I think) Tom is saying. This continues, but the flag could make it official, meaning it changes the help text ("This title will be used for image 'alt' text (for SEO and accessibility)") for the title field.

description can stay or not. Maybe that updates to be labeled "Caption", since that's what it's defaulted to now.

I understand some clients might have need for a third text field for images, but that really seems like the exception, which could be set on a per project basis. This change could be focused on righting the lack of clarity while maintaining connection with the default image widget.

@bgantick
Copy link
Contributor

bgantick commented Oct 5, 2018

Since this is an enhancement, we should avoid re-enforcing bad habits. I would even go so far as to say title shouldn't be used as alt text in apostrophe-images-widgets and this enhancement could rectify that (as well as not use a div element for the rendered description). Alt text is meant to be descriptive and I don't think title suffices. My recommendation is to add an additional alt field and perhaps change description to caption. The enhancement could also add help text to all fields describing how they are used. Again, I really don't think title should be used for alt text. Again, this is an opt-in feature and we can be bold here.

@abea
Copy link
Contributor

abea commented Oct 5, 2018

My recommendation is to add an additional alt field and perhaps change description to caption. The enhancement could also add help text to all fields describing how they are used.

I like this.

@boutell
Copy link
Member

boutell commented Oct 8, 2018

I am having trouble understanding why the right text to show the vision impaired user is not also the right text to support browsing and searching in the media library. People don't often do something well if they have to do almost the same thing twice.

@bgantick
Copy link
Contributor

title and description might be used in combination to produce a <figcaption>, whereas alt would be descriptive, contextual text to use in an alt attribute (not synonymous with either of the other two fields - see examples here: https://webaim.org/techniques/alttext/#context)

@boutell
Copy link
Member

boutell commented Oct 10, 2018

I see. Is there a sensible fallback behavior we could offer, something that makes sense to do if the user doesn't enter both?

@bgantick
Copy link
Contributor

I think falling back to an empty alt attribute would be reasonable here (images with alt="" are treated as decorative and are ignored by screen readers, etc) - there are instances where an empty alt is actually desired.

@stale
Copy link

stale bot commented Jun 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 19, 2020
@bgantick
Copy link
Contributor

Would like to confirm that a dedicated alt text field will be a thing for A3. Doing this a lot project-level in 2.x projects

@stale stale bot removed the stale label Jun 19, 2020
@abea
Copy link
Contributor

abea commented Jun 22, 2020

Yes, that's correct. A3 will only have a simple single image widget, which lets us start fresh and get this right.

Here’s my first pass at fields for Apostrophe 3 image documents:

  • Title - Taken from the file name, but editable. Not used in the default widget markup.
  • Slug - required for all docs
  • Published - I think this would only prevent it from being loaded in templates to the public. See apos-secure-attachments for more security.
  • Media tags
  • Alternate text - Used as the alt attribute
  • Caption - Used in figcaption in the default widget
  • Subsection of metadata - Some of this is taken from the image file itself. This is all current functionality.
    • Credit
    • Credit URL
    • Camera model
    • Capture date

This isn’t changing much other than adding “caption” and explicitly renaming “description” to “alternate text” to clarify usage. People can do whatever they want in their templates, but this would communicate intent.

CC @localghost443 @stuartromanek

@boutell
Copy link
Member

boutell commented Jun 24, 2020 via email

@boutell
Copy link
Member

boutell commented Jun 24, 2020 via email

@boutell
Copy link
Member

boutell commented Jun 24, 2020 via email

@abea
Copy link
Contributor

abea commented Jun 24, 2020

Maybe there's no purpose for title. I was working under the assumption that there had to be one, but maybe not. This is where looking at other CMSes would be useful.

@boutell
Copy link
Member

boutell commented Jun 30, 2020 via email

@abea
Copy link
Contributor

abea commented Jun 30, 2020

Theoretically, yes. I don't know if it's something many people take time to fill out in practice. Does no real harm, though. Having the title default to the file name, but be editable, seems fine and covers bases.

@sachowdhary786
Copy link

Hi all, is this something that is still on the radar/high priority?
As without this, our company is non-compliant to standards.
Unless there is a work-around that we are unaware of in getting the ALT text to display for the images?

@abea abea added the v3 Related to Apostrophe 3 label Aug 18, 2020
@abea
Copy link
Contributor

abea commented Aug 18, 2020

@sachowdhary786 The question of this issue is how to add a dedicated alt text field. That will be part of Apostrophe 3.

There is no barrier to meeting this accessibility requirement in Apostrophe 2, but it does require you to choose the field you will use for alt text. The most common choice, I think, is description. You then would write your templates to use that field in the alt attribute. You could even add fall back options in the template so it could use other fields if someone leaves description blank.

@sachowdhary786
Copy link

Brilliant!
I will go back and give this a shot.
Thanks for coming back to me so quickly on this!

@abea
Copy link
Contributor

abea commented Aug 18, 2020

You're welcome. Unfortunately this became less clear for 2.x than it should have been.

@abea
Copy link
Contributor

abea commented Jul 14, 2021

This is all done for A3. There is a dedicated alt text field and no more confusing description field.

Screen Shot 2021-07-14 at 1 43 58 PM

@abea abea closed this as completed Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement v3 Related to Apostrophe 3
Projects
None yet
Development

No branches or pull requests

6 participants