Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Current accessibility requirements state that all iframes on a page must have unique title attributes.
Videlicet:
The function responsible for rendering iframes, theme_video_filter_iframe(), should render the title attribute, if it has been passed via the shortcode.
Comment | File | Size | Author |
---|---|---|---|
#16 | video_filter-allow_titles-2890782-16.patch | 5.82 KB | Michelle |
#11 | video_title.zip | 1.63 KB | liquidcms |
#8 | support-title-in-iframe-2890782-8.patch | 7.58 KB | cleverington |
#6 | support-title-in-iframe-2890782-6.patch | 1.14 KB | mark_fullmer |
Comments
Comment #2
mark_fullmerThis patch ensures that, if a user has entered the
title:xxx
syntax in the shortcode, it will be included in the rendered attributes of all codecs which use the iframe. User input will be sanitized in the subsequent call todrupal_attributes()
.Comment #3
mark_fullmerComment #4
mark_fullmerComment #5
mgiffordMakes sense to me. Quick read of the patch looks ok. Mind you I don't know this module.
Comment #6
mark_fullmerUpon further testing, I noticed that the existing regex does not account for spaces between words in shortcode parameters. Title attributes likely *would* contain spaces. Therefore, I've refactored the regex expression to find either a string of format xxx:xxx (no spaces) OR xxx:"xxx xxx" (the double quotes are required).
This should receive careful review by the module maintainer, since we don't want to adversely affect other elements that this regex parses. However, my testing of the generic equivalent
preg_match_all("/\s+([a-zA-Z_]+)\:(\s+)?(([0-9a-zA-Z\/]+)|(\"([0-9a-zA-Z\s]*)\"))/i", $input_lines, $output_array);
does work as expected for the following test cases:test:1 title:"foo"
test:string title:"foo baz"
test:string title:"foo baz" width:300
Comment #7
cleverington CreditAttribution: cleverington at University of Texas at Austin commentedTwo things:
Title cannot be last
Tested and regex only picks up the 'first' word if the
title
attribute is the last item in the row.For example:
Fails:
[video:test:1 align:center title:"Some Title Text"]
Only loads: "Some"
Passes:
[video:test:1 title:"Some Title Text" align:center]
Loads: "Some Title Text"
Upgrading the Overall Module
Though useful, the patch would probably serve a better UI/UX (and be used more) to also update.
Meeting in ten, so I know the code is completely invalid (there is no hook_update or hook_form_alter, etc.), but you get the idea.
_video_filter_form
could be changed with a new field:Then, within
_video_filter_process
, make a slight alteration:Though it might be a large endeavor, as it looks like the files within
editors/
will each need adjustment to fix the editor forms.Comment #8
cleverington CreditAttribution: cleverington at University of Texas at Austin commentedAdding a tweak to Patch 6 (based on my comments from comment-7) which adds a data-entry field for the
title
attribute within each CKEditor.Works in Chrome perfectly, but seems to fail on FireFox and Safari in placing the added code within the CKEditor field.
This could be an issue with CKEditor's caching though....
Didn't test the tweaks on either TinyMCE and/or fckeditor.
Next step seems like it would be prudent to revise the Codecs to retrieve and populate the
title
attribute for the user.Comment #9
liquidcms CreditAttribution: liquidcms commentedthanks for adding this, but.. patch is referenced from wrong location. It should be based from the module's directory, not from /modules
but even fixing this the patch fails in 3 places.. but this was with 7.x-3.4, possibly it is against 7.x-3.x
Comment #10
liquidcms CreditAttribution: liquidcms commentedyes, it seems to apply to -dev; but doesn't work (no title is added from the shortcode).. also, -dev seems to be broken on its own.
Comment #11
liquidcms CreditAttribution: liquidcms commentedAs i couldn't get patch to work and mainly because my client didn't want to rely on editors filling in the title with the token, i created this small filter module which pulls the actual title from the video provider (only for YouTube and Vimeo, but likely works elsewhere) and adds as the iframe's title attr.
This works alongside (technically, "after") the video filter but will also work on any manually inserted video iframe (although not sure why someone would do that).
Comment #12
mgiffordThanks Peter.
Comment #13
xeM8VfDh CreditAttribution: xeM8VfDh commentedIs this issue dead? This is causing accessibility issues on my site as well. @liquidcms's module looks cool, but alas, I'm using D8.
Comment #14
mark_fullmerOne workaround for this would be to use the iFrame Title Filter module -- just have it set to run after the video filter in your text format filter processing order.
Comment #15
xeM8VfDh CreditAttribution: xeM8VfDh commentedThanks for the suggestion @mark_fullmer
Still wondering if a contributor can chime in to answer whether core will address this issue. Seems perfectly suitable for core functionality and shouldn't require a module (but good to know that there is one available if need be, though it does seem to be inactive).
Comment #16
MichelleThis patch is based on the one in #8. I looked at that and manually applied the changes to the latest dev and then made fixes to make it work. Note that I only added the CKEditor parts since that's what I needed. The other editors' parts will need to be added and tested for this to be a total solution. But this is working for CKEditor, at least.
Comment #17
DamienMcKennaComment #18
DamienMcKennaMight anyone be able to port Michelle's improvements to TinyMCE? Thanks.