Make WordPress Core

Changeset 36873


Ignore:
Timestamp:
03/07/2016 09:59:02 AM (9 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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/embed.php

    r36708 r36873  
    491491        absint( $width ),
    492492        absint( $height ),
    493         esc_attr__( 'Embedded WordPress Post' )
     493        esc_attr(
     494            sprintf(
     495                /* translators: 1: post title, 2: site name */
     496                __( '“%1$s” — %2$s' ),
     497                get_the_title( $post ),
     498                get_bloginfo( 'name' )
     499            )
     500        )
    494501    );
    495502
  • 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.