Closed as a duplicate of https://www.drupal.org/project/video_embed_field/issues/2913925
Problem/Motivation
Meet WCAG standards for iframe accessability: Using the title attribute of the frame and iframe elements
Proposed resolution
Add a default implementation of renderEmbedCode() in ProviderPluginBase and add provider specific elements in an overriding method in extending classes.
Remaining tasks
This module doesn't test a full render array, so none at present.
User interface changes
No UI visible UI changes but screen readers will now have access to a frame title.
API changes
Code extending the base plugin in custom development would need to be refactored to pick up this change. The change is backwards compatible since this method was not previously implemented at the base class level.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #52 | interdiff-2913598-51-52.txt | 3.54 KB | prudloff |
| #52 | video_embed_field-2913598-52.patch | 19.43 KB | prudloff |
| #51 | 2913598-50video-embed-title.patch | 20.71 KB | byrongary |
| #49 | 2913598-49fixes-to-renderoutput-not_container.patch | 20.91 KB | skaught |
| #36 | video_embed_field-title_attribute-2913598-34.patch | 10.36 KB | kkumaren |
Issue fork video_embed_field-2913598
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2913598-accessibility-enhancements-for
changes, plain diff MR !60
Comments
Comment #2
fathershawnThis patch was cut against 8.x-1.x but at the moment these files are unchanged in 8.x-2.x so it would apply in both branches.
Comment #4
fathershawnI didn't look deeply enough into the test code.
\Drupal\video_embed_field_mock_provider\Plugin\video_embed_field\Provider\MockProvider::renderEmbedCodeled me to believe these render arrays weren't tested. I'll update the tests and re-roll.Comment #5
fathershawnAdded title values to expected render arrays.
Comment #6
mgiffordComment #7
fathershawnI'm not clear on why the test fails :(
Comment #8
georob commentedReading through the patch for the tests, it looks on the surface that the changes are applied to each attributes section, adding the title for each set.
Weirdly, however, the patch as applied by composer changes the file to add all the title attributes at line 363. See attached screenshot. Could this be the source of the failures?
Comment #9
fathershawnIt could be! That's very puzzling.
Comment #10
leolandotan commentedI'll try to work on this.
Comment #11
leolandotan commentedHere I have implemented the Vimeo implementation that gets the Video title into the Youtube class and updated the test cases to be expecting the title attribute in the iframe already.
Hope everything is in order.
Thanks!
Comment #12
leolandotan commentedComment #14
leolandotan commentedFixed the test errors to the best of my knowledge.
Comment #15
leolandotan commentedSorry for the wrong interdiff. This is the right one.
Comment #17
leolandotan commentedAdditional things done:
a:6:{s:20:"emvideo_data_version";i:5;s:23:"emvideo_youtube_version";i:5;s:8:"duration";i:0;s:8:"playlist";i:0;s:9:"thumbnail";a:1:{s:3:"url";s:43:"http://img.youtube.com/vi/BmFFPozHKFU/0.jpg";}s:5:"flash";a:3:{s:3:"url";s:32:"http://youtube.com/v/BmFFPozHKFU";s:4:"size";s:1:"0";s:4:"mime";s:29:"application/x-shockwave-flash";}}Test results
Comment #19
leolandotan commentedFixed the error:
The patch for this comment is just about the same as in comment #17 but instead of using:
git diff 8.x-1.x > video_embed_field-title_attribute-2913598-19.patchI now used:
git diff-index 8.x-1.x --binary > video_embed_field-title_attribute-2913598-19.patchAdditional issues
I'm trying to apply the patch to 8.x-1.5 but it doesn't cleanly apply. I get the following errors:
Any ideas on how to fix this?
Thanks!
Comment #20
leolandotan commentedIf anyone is interested, I have created a patch as well directed to 8.1.5 because as seen in the previous comment, the 8.x-1.x patch conflicts when applied to 8.1.5 due to other changes already in 8.x-1.x.
This patch contains:
Please feel free to correct me if I needed to create a separate issue for 8.1.5 and just relating it to this issue.
Thanks!
Comment #21
wrd commentedFor the most part, this patch still applies to 8.x-2.x, failing only on various test files. I've stripped out the patches to test files that failed to apply, and the result appears to work.
Comment #22
bdlangton commentedPatch #21 worked for me. Here is a patch for 8.x-2.x with tests updated to pass.
Comment #23
bdlangton commentedPatch #22 doesn't apply to 2.0, so rerolling just for that.
Comment #24
mgiffordFixing tagging.
Comment #25
gurvan commentedI provide a patch in another issue that do the trick https://www.drupal.org/project/video_embed_field/issues/2913925#comment-... (I do that because I work on the project where I also need the patch proposed in this issue
Comment #26
wylbur commentedPatch #23 doesn't apply to 2.2, so rerolling just for that!
(disregard the second file, sorry!)
Comment #29
phillamb168 commentedRerolling, I had some issues applying this to 8.7.7
Comment #30
georob commentedThis issue seems to be addressed in https://www.drupal.org/project/video_embed_field/issues/2913925. I'd favor closing this issue as a duplicate in favor of that issue, which is currently RTBC, and is more feature complete, where as this issue does a basic job. Hopefully the maintainers can chime in to what they would prefer.
Comment #32
fathershawnThat sounds reasonable. Someone can re-open if needed.
Comment #33
javier_rey commentedThis same problem occurs for the youtube provider, here is the patch integrating the 2 changes.
Comment #34
javier_rey commentedComment #35
javier_rey commentedComment #36
kkumaren commented#33 is giving a 403 Forbidden. SSL is required to perform this operation.
I've updated the patch to use ssl instead.
Comment #37
alisonChanging to "won't fix," and copying/pasting the note left by the video_embed_field maintainer on other threads, for anyone else who lands here like I did :)
Comment #38
skaught^dropped wrong file. oops.
this variant of #29 checks runtime for use of http/s by adding getProtocol() to ProviderPluginBase. let the project decide what it's using @mixed protocols.
A11y: add a unique id and name attributes to iframe per field item.
Comment #39
skaughtComment #40
skaughtignore this patch. has bad syntax. friday brain (:
Comment #41
skaughtComment #42
skaughtpost friday cleanup.
set field max-age 0, complete docblock note for new var.
Comment #43
skaughtThe Video Embed Filter also needs attributes.
Comment #44
skaughtComment #45
skaughtinclude A tag in iframe. change vimeo to use httpClient.
I am working on one of the 60,000 client sites still using this module.... it needs fixes regardless of suggestion to use core media.
Comment #46
skaughtComment #47
skaught44 patch issue.
Comment #48
skaughti'm skipping lint. but fixing container name (oversight)
Comment #49
skaughthandle patch with dev head, not release.
Comment #50
skaughtComment #51
byrongary commentedReroll for Drupal 10 spaceless tag
Comment #52
prudloff commentedThe YouTube API refuses non-HTTPS requests and it is a bad practice to call external services without HTTPS.
Comment #54
herved commentedI see some overlap here with #3200253: Add "title" attribute to YouTube, Vimeo, and Playlist embeds which seems a bit better scoped and ahead in terms of implementation IMHO.
Hence, moving to needs work. I will focus on the other issue for our project needs.
Some observations:
Why do we need to kill the page cache here?
This calls oEmbedData() twice, so will fetch twice which could be avoided by caching the response, similar to what is done in #3200253: Add "title" attribute to YouTube, Vimeo, and Playlist embeds
This changes the method signature, so breaks backwards compatibility which isn't ideal.
I think it would be best to use \Drupal\Component\Serialization\Json::decode
Comment #55
prudloff commentedThe Twig spaceless filter is deprecated: https://twig.symfony.com/doc/3.x/filters/spaceless.html
Comment #57
prudloff commentedJust noticed this as well, it bubbles and disables cache for the entire page.
I agree that #3200253: Add "title" attribute to YouTube, Vimeo, and Playlist embeds has the same goal and is more active, closing as duplicate.
Comment #58
prudloff commentedComment #59
prudloff commented