Make WordPress Core

Changeset 42790


Ignore:
Timestamp:
03/06/2018 05:20:07 PM (7 years ago)
Author:
afercia
Message:

Accessibility: Make the Widgets screen "Enable accessibility mode" link more discoverable.

For a number of years, the link to the Widgets screen "Accessibility mode" lived
in the Screen Options panel, hidden by default. Many users, including assistive
technologies users, weren't able to find it or even aware it existed. By bringing
the link in the main screen, visible by default, this change makes the
"Accessibility mode" easily discoverable for everyone.

Props chetan200891, antonioeatgoat.
Fixes #42778.

Location:
trunk/src/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/widgets.css

    r42572 r42790  
    496496
    497497/* Accessibility Mode */
     498.widget-access-link {
     499    float: right;
     500    margin: -5px 0 10px 10px;
     501}
     502
    498503.widgets_access #widgets-left .widget .widget-top {
    499504    cursor: auto;
     
    794799        max-width: 480px;
    795800    }
     801
     802    .widget-access-link {
     803        float: none;
     804        margin: 15px 0 0 0;
     805    }
    796806}
    797807
  • trunk/src/wp-admin/includes/class-wp-screen.php

    r42747 r42790  
    919919        $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' );
    920920
    921         switch ( $this->base ) {
    922             case 'widgets':
    923                 $nonce                  = wp_create_nonce( 'widgets-access' );
    924                 $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=' . urlencode( $nonce ) . '">' . __( 'Enable accessibility mode' ) . '</a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=' . urlencode( $nonce ) . '">' . __( 'Disable accessibility mode' ) . "</a></p>\n";
    925                 break;
    926             case 'post':
    927                 $expand                 = '<fieldset class="editor-expand hidden"><legend>' . __( 'Additional settings' ) . '</legend><label for="editor-expand-toggle">';
    928                 $expand                .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />';
    929                 $expand                .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></fieldset>';
    930                 $this->_screen_settings = $expand;
    931                 break;
    932             default:
    933                 $this->_screen_settings = '';
    934                 break;
     921        $this->_screen_settings = '';
     922
     923        if ( 'post' === $this->base ) {
     924            $expand                 = '<fieldset class="editor-expand hidden"><legend>' . __( 'Additional settings' ) . '</legend><label for="editor-expand-toggle">';
     925            $expand                .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />';
     926            $expand                .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></fieldset>';
     927            $this->_screen_settings = $expand;
    935928        }
    936929
  • trunk/src/wp-admin/widgets.php

    r42719 r42790  
    400400    );
    401401}
    402 ?>
     402
     403$nonce = wp_create_nonce( 'widgets-access' );
     404?>
     405<div class="widget-access-link">
     406    <a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=<?php echo urlencode( $nonce ); ?>"><?php _e( 'Enable accessibility mode' ); ?></a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=<?php echo urlencode( $nonce ); ?>"><?php _e( 'Disable accessibility mode' ); ?></a>
     407</div>
    403408
    404409<hr class="wp-header-end">
Note: See TracChangeset for help on using the changeset viewer.