Make WordPress Core


Ignore:
Timestamp:
03/20/2019 05:21:56 PM (6 years ago)
Author:
afercia
Message:

Accessibility: Ensure embed iframes have a title attribute.

Screen reader users rely on the iframe title attribute to describe the contents of iframes. A meaningful title attribute allows to quickly identify the iframe content, so users can determine which iframe to enter and explore in detail or skip if desired.
Note: this is the only case where a title attribute is required for compliance with the W3C Web Content Accessibility Guidelines (WCAG).

  • checks for oEmbed response of type video or rich
  • checks if they use an iframe
  • fetches the title (if any) from the oEmbed response
  • adds the title to the embed iframe

Props bamadesigner, TomHarrigan, swissspidy, jrf, afercia.
Fixes #40245.

File:
1 edited

Legend:

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

    r44941 r44942  
    574574
    575575add_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10, 3 );
     576add_filter( 'oembed_dataparse', 'wp_filter_oembed_iframe_title_attribute', 20, 3 );
    576577add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 );
    577578add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 );
Note: See TracChangeset for help on using the changeset viewer.