Make WordPress Core


Ignore:
Timestamp:
06/30/2020 01:54:40 PM (4 years ago)
Author:
afercia
Message:

Accessibility: Privacy: Accessibility improvements for the Privacy Policy Guide page.

Improves accessibility of the "Copy this section" button and "Return to Top" link:

  • uses setTimeout() and clearTimeout() to properly handle the "Copied!" text
  • simplifies the button text by removing the redundant visually hidden text
  • fixes the mismatching visual and DOM order of the Copy button and the "Return to Top" link
  • improves the "Return to Top" links by providing real page fragment identifiers, when possible
  • hides the "Return to Top" up arrow from assistive technologies
  • minor coding standards

Props afercia, garrett-eclipse.
See #48463, #50322.
Fixes #50335.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-privacy-policy-content.php

    r48145 r48234  
    413413
    414414            $content .= '<div class="policy-text">' . $section['policy_text'] . '</div>';
    415             $content .= '<a href="#" class="return-to-top">' . __( '&uarr; Return to Top' ) . '</a>';
    416415
    417416            if ( empty( $section['removed'] ) ) {
     
    419418                $content .= '<button type="button" class="privacy-text-copy button">';
    420419                $content .= __( 'Copy this section to clipboard' );
    421                 $content .= '<span class="screen-reader-text">';
    422                 /* translators: %s: Plugin name. */
    423                 $content .= sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
    424                 $content .= '</span>';
    425420                $content .= '</button>';
    426421                $content .= '<span class="success" aria-hidden="true">' . __( 'Copied!' ) . '</span>';
    427422                $content .= '</div>';
    428423            }
     424
     425            $content .= '<a href="#wpbody" class="return-to-top"><span aria-hidden="true">&uarr; </span> ' . __( 'Return to Top' ) . '</a>';
    429426
    430427            $content .= '</div>'; // End of .privacy-text-section.
Note: See TracChangeset for help on using the changeset viewer.