pupunzi / jquery.mb.YTPlayer

use a custom yutube player for a video as background on jQuery framework
https://pupunzi.com/mb.components/mb.YTPlayer/demo/demo.html
1.34k stars 427 forks source link

Change Iframe default title value #479

Closed tourtools closed 3 years ago

tourtools commented 3 years ago

To be compliant with WCAG guidelines we need a way to modify the YT iframe title which is by default title="YouTube video player" when having two or more background video on the same page, the title duplication is noticed as an accessibility issue, is there a solution?

pupunzi commented 3 years ago

@tourtools Hi, the iframe is injected by the YouTube API and it is not under the plugin control. At the time you can not modify it other than via javascript after the YTPlayer fires the onReady event:

onReady : function (player) { $(player.playerEl).attr("title", "YTPlayer_"+ (new Date().getTime())) }

tourtools commented 3 years ago

thank you @pupunzi it is a good workaround, now I have to verify if siteimprove.com (the accessibility tools we are using) checks the DOM before or after .js are triggered,

pupunzi commented 3 years ago

If it gets the iframe then it means that it checks the DOM after the javascript runs because the iframe is injected by the javascript API

tourtools commented 3 years ago

√ it works