WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/07/2016 09:59:02 AM (4 years ago)
Author:
swissspidy
Message:

Embeds: Adjust the iframe title attribute for improved accessibility.

Changes the title attribute from Embedded WordPress Post to "Post name" — site title.

Props ramiy.
Fixes #35804.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/oembed/template.php

    r36694 r36873  
    243243    function test_get_post_embed_html() {
    244244        $post_id = self::factory()->post->create();
    245 
    246         $expected = '<iframe sandbox="allow-scripts" security="restricted" src="' . esc_url( get_post_embed_url( $post_id ) ) . '" width="200" height="200" title="Embedded WordPress Post" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>';
     245        $title = esc_attr(
     246            sprintf(
     247                __( '&#8220;%1$s&#8221; &#8212; %2$s' ),
     248                get_the_title( $post_id ),
     249                get_bloginfo( 'name' )
     250            )
     251        );
     252
     253        $expected = '<iframe sandbox="allow-scripts" security="restricted" src="' . esc_url( get_post_embed_url( $post_id ) ) . '" width="200" height="200" title="' . $title . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>';
    247254
    248255        $this->assertStringEndsWith( $expected, get_post_embed_html( 200, 200, $post_id ) );
Note: See TracChangeset for help on using the changeset viewer.