Problem/Motivation
Currently the image-to-iframe media replacement functionality is not accessible.
Steps to reproduce
Create a media field. Allow oembed / remote-video media. Set Display Blazy Media Replacement settings to "Image to Iframe".
Proposed resolution
- Make current play and close icons buttons.
- Add title and aria-label to play and close buttons to explain what they do.
- Add a default alt tag and title to the placeholder image to explain it is a preview for the video.
- Add aria-live="polite" to the container to notify the user that the iframe is being loaded and closed.
- Potentially add a data-title to the buttons and then use that to add a title to the generated iframe to give the user context.
Remaining tasks
Make current play and close icons buttons.Add title and aria-label to play and close buttons to explain what they do.Add a default alt tag and title to the placeholder image to explain it is a preview for the video.Add aria-live="polite" to the container to notify the user that the iframe is being loaded and closed.Potentially add a data-iframe-title to the buttons and then use that to add a title to the generated iframe to give the user context.
Data model changes
Pass title from media into settings to give context to the blazy item.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | image_to_iframe_alt-3210635-12.patch | 4.7 KB | jastraat |
| #7 | example.jpg | 86.95 KB | Anonymous (not verified) |
| #2 | 3210635-02.patch | 4.32 KB | grathbone |
Comments
Comment #2
grathbone commentedPatch attached
Comment #3
gausarts commentedThank you.
I haven't been able to review it properly. Just 2 minors:
+ $attributes['alt'] = t('Preview image for the video "@label" – @alt.', $translation_replacements);I am on cell now, what is the characters before @alt :)
To avoid undefined index, consider adding title here:
https://git.drupalcode.org/project/blazy/-/blob/8.x-2.x/src/BlazyDefault...
So far, title was only for Views settings.
Comment #4
gausarts commentedAdditional reviews:
This overrode title as a form option which points to a field name with a text.
We need to rename
titlehere to something else, saysaccessible_titleand adjust the rest accordingly sincetitleis already preserved for title field name at Media entities or Views option, not the actual text.I think that is the only problem.Minor update:
The
t()functions at PHP classes need changing into FormattableMarkup to pass CS.Hopefully that will be all for now.
Thanks.
Comment #5
Anonymous (not verified) commentedSame issue for Blazy to Colorbox using oEmbed Videos.
The thumbnails do not include an alt tag or Aria label.
Comment #6
Anonymous (not verified) commentedIs it possible to use field mapping for oEmbed. I.e. Allow the site builder to use the media title field or other field a builder would add to the media type?
Comment #7
Anonymous (not verified) commentedComment #8
Anonymous (not verified) commentedAnother option would to use an aria-label which can utilize a media field to get the label text.
Comment #9
Anonymous (not verified) commentedAdded the patch to a Drupal 9 dev site it works with blazy image to colorbox.
Comment #10
gausarts commented@Bwolf , thanks for additional reviews.
> Another option would to use an aria-label which can utilize a media field to get the label text.
Noted, thanks.
> Added the patch to a Drupal 9 dev site it works with blazy image to colorbox.
Unfortunately, this patch overrode
settings.titlewhich points to a field name as a form option, not as its value, nor other meaningful texts. See #4.We'll postpone this till the next release till we have time to fix it.
Feel free to update your patch as per #4 and #8. Thanks.
Comment #11
Anonymous (not verified) commentedThanks @gausarts!
I look forward to the patch/update. :)
As soon at the module is updated with this functionality I can move from VEF to oEmbed video on all my projects.
Comment #12
jastraat commentedUpdated patch to address gausarts' concerns with the title setting being overridden. (Does not use aria-label.)
Comment #13
gausarts commentedLooks good, thank you.
Two nit issues, aside from CS:
accessible_titleis not a valid IMG attribute, it should be just regular IMGtitle. I understand my comment at #4 might confuse you about$settings['title'] vs. $settings['accessible_title']which was translated into$attributes['accessible_title']while should be$attributes['title'].We should have provided a cache clear
hook_post_updatesince it modified twig, but not crucial, manual clearing will do. Aside there was already ahook_post_updatefor the new native grid which should take care of this as well.Comment #15
gausarts commentedCommitted with minor fixes for the above-mentioned issues.
Also removed unused
data-iframe-titlefrom close button. Only needed for play button.If any side issues or additional improvements to follow up, feel free to create a new thread.
Thank you all for kind contributions.