File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -382,14 +382,19 @@ public function generate(): string
382382 // Never set src attribute for YouTube/Vimeo - this should be done by JavaScript after consent
383383 } else {
384384 $ code .= " src= \"" . rex_escape ($ sourceUrl ) . "\"" ;
385+ // Add aria-label for local videos/audio to ensure proper accessibility
386+ $ ariaLabel = $ this ->title ?: $ this ->getText ("a11y_ {$ mediaType }_player " );
387+ $ code .= " aria-label= \"" . rex_escape ($ ariaLabel ) . "\"" ;
385388 }
386389
387390 $ code .= " crossorigin> " ;
388391
389392 $ code .= "<media-provider> " ;
390393
391394 if (!$ isAudio && !empty ($ this ->poster )) {
392- $ code .= "<media-poster class= \"vds-poster \" src= \"" . rex_escape ($ this ->poster ['src ' ]) . "\" alt= \"" . rex_escape ($ this ->poster ['alt ' ]) . "\"></media-poster> " ;
395+ // Use title as fallback alt text if poster alt is empty for accessibility
396+ $ posterAlt = !empty ($ this ->poster ['alt ' ]) ? $ this ->poster ['alt ' ] : (!empty ($ this ->title ) ? $ this ->title : $ this ->getText ('a11y_video_poster ' ));
397+ $ code .= "<media-poster class= \"vds-poster \" src= \"" . rex_escape ($ this ->poster ['src ' ]) . "\" alt= \"" . rex_escape ($ posterAlt ) . "\"></media-poster> " ;
393398 }
394399
395400 if ($ videoInfo ['platform ' ] === 'default ' ) {
You can’t perform that action at this time.
0 commit comments