From 7e95809fd0349c4d830f1199f86273d35b721ca2 Mon Sep 17 00:00:00 2001 From: Rick Curran Date: Mon, 9 Sep 2019 17:21:55 +0100 Subject: [PATCH 1/2] Added Title attribute to the iframe for Archive.org book embed This commit adds a `Title` attribute to the iframe for Archive.org book embed to improve the Section 508 and WCAG 2.0 accessibility compliance. --- modules/shortcodes/archiveorg-book.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/shortcodes/archiveorg-book.php b/modules/shortcodes/archiveorg-book.php index 88ac328c4cf4f..1e0af4a661748 100644 --- a/modules/shortcodes/archiveorg-book.php +++ b/modules/shortcodes/archiveorg-book.php @@ -78,7 +78,9 @@ function jetpack_archiveorg_book_shortcode( $atts ) { $url = esc_url( set_url_scheme( "http://archive.org/stream/{$id}?ui=embed#mode/1up" ) ); - $html = "
"; + $title = esc_html__( 'Archive.org Book', 'jetpack' ); + + $html = "
"; return $html; } From bf2acf7c707c7c009210ee9fa009e3d73e52ceb2 Mon Sep 17 00:00:00 2001 From: Rick Curran Date: Mon, 16 Sep 2019 09:45:03 +0100 Subject: [PATCH 2/2] Updated test for Archive-book shortcode to include the new `title` attribute Updated the Unit test for the Archive-book shortcode to include the new `title` attribute on the iframe in the test code. --- tests/php/modules/shortcodes/test-class.archiveorg.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/php/modules/shortcodes/test-class.archiveorg.php b/tests/php/modules/shortcodes/test-class.archiveorg.php index e477bd729fe77..0a3cdf04e7ae3 100644 --- a/tests/php/modules/shortcodes/test-class.archiveorg.php +++ b/tests/php/modules/shortcodes/test-class.archiveorg.php @@ -48,8 +48,9 @@ public function test_shortcode_single_element() { */ public function test_shortcode_book() { $id = 'goodytwoshoes00newyiala'; + $title = 'Archive.org Book'; $content = "[archiveorg-book id='$id' width='600' height='300']"; $shortcode_content = do_shortcode( $content ); - $this->assertContains( "iframe src='http://archive.org/stream/$id?ui=embed#mode/1up' width='600' height='300'", $shortcode_content ); + $this->assertContains( "iframe title='$title' src='http://archive.org/stream/$id?ui=embed#mode/1up' width='600' height='300'", $shortcode_content ); } } \ No newline at end of file