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

Image alt tags #145

Closed
Newnab opened this issue Jul 7, 2020 · 3 comments
Closed

Image alt tags #145

Newnab opened this issue Jul 7, 2020 · 3 comments

Comments

@Newnab
Copy link
Member

Newnab commented Jul 7, 2020

I'm unsure what the best way to solve this is but I think we could use a more diligent approach to alt tags for images (on both responsive and regular images). At the minute it seems like we let things render without them by default, which means they're often missed. In some cases, responsive images in particular, I'm not even sure what the best way would be to render one with a specific alt text - you could overwrite the ResponsiveMediaField.liquid but then all your alt tags will be the same, which works on some sites but is unlikely to work for all.

My initial thought is that alt text should be a property you can set directly on an image in the CMS if possible, and our defaults should output that. But it would be useful to be able to override it when using it in specific places easily.

For example, an ideal route would be:

  1. You have an image of a car.
  2. In the CMS you assign it an alt text of "Photograph of a nice car".
  3. When that image is used by default it should have that alt text applied, or an empty alt tag if none is defined.
  4. Maybe it's even used in a responsive media field, but you still have that alt text by default.
  5. However you might also use that image in a responsive media field that you want to use as a background and forcefully make it alt="" role="presentation". So it would be good to have a mechanism for outputting images in a consistent way, but be able to overwrite the attributes. If think I can imagine how this would work as cshtml but I'm not sure how you'd do it in liquid.

Thoughts @peterkeating ?

@peterkeating
Copy link
Member

peterkeating commented Jul 7, 2020

@Newnab One thing that prevents alt text to be associated to a media file is the media file is not stored as a record in the database, it's a file on the server so there isn't really any way to associate alt text to it. Here is an issue in the main Orchard Core repo where they discuss approaches for alt text with regards to the media picker field - OrchardCMS/OrchardCore#4326.

I think you should raise an issue in our fields module for adding support for alt text.

@Newnab
Copy link
Member Author

Newnab commented Jul 7, 2020

Issue raised for Responsive Media fields here: EtchUK/Etch.OrchardCore.Fields#55

Are you suggesting for regular media fields that we should also expand the fields module to include a MediaWithAltText field or similar, per that issue discussion? If so I can create a separate issue for that.

@peterkeating
Copy link
Member

MediaWithAltText field wouldn't be too hard to add for a single image, multiple images could be a tricky one. Agree that if we do (I think we should definitely do it) add this it should be added to the fields module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants