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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49113 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-10-09 15:51:34 +00:00
parent 4917ae2ccf
commit c35126e1b9
2 changed files with 20 additions and 17 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 );
?>
<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>