Skip to content

Commit

Permalink
Add title attribute to amp-youtube in addition to fallback content
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Sep 27, 2019
1 parent cafc324 commit b517472
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/embeds/class-amp-youtube-embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private function parse_props( $html, $url ) {
$props = [];

if ( preg_match( '#<iframe[^>]*?title="(?P<title>[^"]+)"#s', $html, $matches ) ) {
// @todo Is a fallback a suitable alternative for a11y for the title attribute?
$props['title'] = $matches['title'];
$props['fallback'] = sprintf(
'<a fallback href="%s">%s</a>',
esc_url( $url ),
Expand Down Expand Up @@ -196,7 +196,7 @@ public function render( $args, $url ) {
'amp-youtube',
array_merge(
[ 'data-videoid' => $args['video_id'] ],
wp_array_slice_assoc( $args, [ 'width', 'height', 'layout' ] )
wp_array_slice_assoc( $args, [ 'layout', 'width', 'height', 'title' ] )
),
$args['fallback']
);
Expand Down

0 comments on commit b517472

Please sign in to comment.