Keyboard focus for Lyte videos
-
Hello, thanks for this great plugin!
I’ve noticed that by default (at least with the settings I am using) YouTube Lyte thumbnails do not seem to be keyboard focusable. For accessibility this is pretty important. I could change the ‘add youtube link below video’ setting, but I’d rather not take the user offsite. I have tried using an API filter like this to hack together a solution:
// Allow keyboard focus on Youtube Lyte add_filter( 'lyte_match_postparse_template', function( $lytetemplate ) { return str_replace( ' class="lyte-wrapper">', ' class="lyte-wrapper" role="button" aria-label="play video" tabindex="0">', $lytetemplate ); } );
…but so far have had no success.
I think much better solution would be either a filter or setting which would wrap the thumbnail in a <button> element like this, and make the button element play the video:
<button aria-label="play video: [title here]"> //thumbnail </button>
Do you have a recommendation on how to accomplish that? I realize it would create some styling issues due to the way different themes style buttons, but I could override that with CSS.
Failing that, just a recommendation on how to get my filter code working (and what is the clickable element I should apply it to) would be so much appreciated.
Thanks!
- The topic ‘Keyboard focus for Lyte videos’ is closed to new replies.