Accessibility: Widgets: Add a "Cancel" link when editing a widget in accessibility mode.

This allows the user to go back without saving any changes to the widget.

Props garrett-eclipse, audrasjb, afercia.
Fixes #49354.
Built from https://develop.svn.wordpress.org/trunk@49113


git-svn-id: http://core.svn.wordpress.org/trunk@48875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-10-09 15:53:08 +00:00
parent 7a622f6ffd
commit c628344422
3 changed files with 21 additions and 18 deletions

View File

@ -294,8 +294,7 @@ function wp_widget_control( $sidebar_args ) {
<div class="alignleft">
<button type="button" class="button-link button-link-delete widget-control-remove"><?php _e( 'Delete' ); ?></button>
<span class="widget-control-close-wrapper">
|
<button type="button" class="button-link widget-control-close"><?php _e( 'Done' ); ?></button>
| <button type="button" class="button-link widget-control-close"><?php _e( 'Done' ); ?></button>
</span>
</div>
<div class="alignright<?php echo $noform_class; ?>">

View File

@ -346,22 +346,26 @@ if ( isset( $_GET['editwidget'] ) && $_GET['editwidget'] ) {
</div>
<div class="widget-control-actions">
<?php
if ( isset( $_GET['addnew'] ) ) {
?>
<a href="widgets.php" class="button alignleft"><?php _e( 'Cancel' ); ?></a>
<?php
} else {
submit_button( __( 'Delete' ), 'alignleft', 'removewidget', false );
}
submit_button( __( 'Save Widget' ), 'primary alignright', 'savewidget', false );
?>
<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $widget_id ); ?>" />
<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" />
<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" />
<?php wp_nonce_field( "save-delete-widget-$widget_id" ); ?>
<br class="clear" />
<div class="alignleft">
<?php if ( ! isset( $_GET['addnew'] ) ) : ?>
<input type="submit" name="removewidget" id="removewidget" class="button-link button-link-delete widget-control-remove" value="<?php _e( 'Delete' ); ?>" />
<span class="widget-control-close-wrapper">
| <a href="widgets.php" class="button-link widget-control-close"><?php _e( 'Cancel' ); ?></a>
</span>
<?php else : ?>
<a href="widgets.php" class="button-link widget-control-close"><?php _e( 'Cancel' ); ?></a>
<?php endif; ?>
</div>
<div class="alignright">
<?php submit_button( __( 'Save Widget' ), 'primary alignright', 'savewidget', false ); ?>
<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $widget_id ); ?>" />
<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" />
<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" />
<?php wp_nonce_field( "save-delete-widget-$widget_id" ); ?>
</div>
<br class="clear" />
</div>
</form>
</div>
</div>

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-49112';
$wp_version = '5.6-alpha-49113';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.