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"> <div class="alignleft">
<button type="button" class="button-link button-link-delete widget-control-remove"><?php _e( 'Delete' ); ?></button> <button type="button" class="button-link button-link-delete widget-control-remove"><?php _e( 'Delete' ); ?></button>
<span class="widget-control-close-wrapper"> <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> </span>
</div> </div>
<div class="alignright<?php echo $noform_class; ?>"> <div class="alignright<?php echo $noform_class; ?>">

View File

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