WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/16/2017 05:58:07 PM (3 years ago)
Author:
afercia
Message:

Accessibility: Improve the File Editors interstitial warning.

The warning displayed upon first visit on the File Editors introduced in [41774]
needs to be the only perceivable content in the page for users of assistive
technologies. It looks like a modal but it's not exactly an ARIA dialog, not an
ARIA alert either, and needs some special treatment.

  • constrains tabbing within the modal
  • uses wp.a11y.speak() to make screen readers announce the modal message
  • hides all the other page content from assistive technologies using aria-hidden="true"

This way, even if users miss the speak message, the warning is actually the only
perceivable content in the page.

Fixes #42110.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/plugin-editor.php

    r41865 r41876  
    293293    }
    294294?>
    295 <div id="file-editor-warning" class="notification-dialog-wrap file-editor-warning hide-if-no-js">
     295<div id="file-editor-warning" class="notification-dialog-wrap file-editor-warning hide-if-no-js hidden">
    296296    <div class="notification-dialog-background"></div>
    297     <div class="notification-dialog" role="dialog" aria-labelledby="file-editor-warning-title" tabindex="0">
     297    <div class="notification-dialog">
    298298        <div class="file-editor-warning-content">
    299             <h1 id="file-editor-warning-title"><?php _e( 'Heads up!' ); ?></h1>
    300             <p><?php _e( 'You appear to be making direct edits to your plugin in the WordPress dashboard. We recommend that you don&#8217;t! Editing plugins directly may introduce incompatibilities that break your theme or other plugins, and can leave you unable to log back in to WordPress and undo changes.' ); ?></p>
    301             <p><?php _e( 'If you absolutely have to edit this plugin, create a copy with a new name and hang on to the original version, so you can re-enable a functional version if something goes wrong.' ); ?></p>
     299            <div class="file-editor-warning-message">
     300                <h1><?php _e( 'Heads up!' ); ?></h1>
     301                <p><?php _e( 'You appear to be making direct edits to your plugin in the WordPress dashboard. We recommend that you don&#8217;t! Editing plugins directly may introduce incompatibilities that break your theme or other plugins, and can leave you unable to log back in to WordPress and undo changes.' ); ?></p>
     302                <p><?php _e( 'If you absolutely have to edit this plugin, create a copy with a new name and hang on to the original version, so you can re-enable a functional version if something goes wrong.' ); ?></p>
     303            </div>
    302304            <p>
    303305                <a class="button file-editor-warning-go-back" href="<?php echo esc_url( $return_url ); ?>"><?php _e( 'Go back' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.