mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Application Passwords: Allow enter key to submit profile form.
Fix the enter key in profile form fields moving focus to the application password input instead of submitting the profile update for. Replace the submit button type used for application passwords with `button type="button"` and ensure that the enter key's native behavior isn't overwritten. props audrasjb, alexstine, promz, sabernhardt. Fixes #52849. git-svn-id: https://develop.svn.wordpress.org/trunk@51086 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
494f3644fd
commit
bad2471fa9
@ -150,6 +150,13 @@
|
||||
} );
|
||||
} );
|
||||
|
||||
$newAppPassField.on( 'keypress', function ( e ) {
|
||||
if ( 13 === e.which ) {
|
||||
e.preventDefault();
|
||||
$newAppPassButton.trigger( 'click' );
|
||||
}
|
||||
} );
|
||||
|
||||
// If there are no items, don't display the table yet. If there are, show it.
|
||||
if ( 0 === $appPassTbody.children( 'tr' ).not( $appPassTrNoItems ).length ) {
|
||||
$appPassTwrapper.hide();
|
||||
|
||||
@ -110,15 +110,13 @@ class WP_Application_Passwords_List_Table extends WP_List_Table {
|
||||
* @param array $item The current application password item.
|
||||
*/
|
||||
public function column_revoke( $item ) {
|
||||
submit_button(
|
||||
__( 'Revoke' ),
|
||||
'delete',
|
||||
'revoke-application-password-' . $item['uuid'],
|
||||
false,
|
||||
array(
|
||||
/* translators: %s: the application password's given name. */
|
||||
'aria-label' => sprintf( __( 'Revoke "%s"' ), $item['name'] ),
|
||||
)
|
||||
$name = 'revoke-application-password-' . $item['uuid'];
|
||||
printf(
|
||||
'<button type="button" name="%1$s" id="%1$s" class="button delete" aria-label="%2$s">%3$s</button>',
|
||||
esc_attr( $name ),
|
||||
/* translators: %s: the application password's given name. */
|
||||
esc_attr( sprintf( __( 'Revoke "%s"' ), $item['name'] ) ),
|
||||
__( 'Revoke' )
|
||||
);
|
||||
}
|
||||
|
||||
@ -156,7 +154,7 @@ class WP_Application_Passwords_List_Table extends WP_List_Table {
|
||||
<div class="tablenav <?php echo esc_attr( $which ); ?>">
|
||||
<?php if ( 'bottom' === $which ) : ?>
|
||||
<div class="alignright">
|
||||
<?php submit_button( __( 'Revoke all application passwords' ), 'delete', 'revoke-all-application-passwords', false ); ?>
|
||||
<button type="button" name="revoke-all-application-passwords" id="revoke-all-application-passwords" class="button delete"><?php _e( 'Revoke all application passwords' ); ?></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="alignleft actions bulkactions">
|
||||
@ -235,10 +233,10 @@ class WP_Application_Passwords_List_Table extends WP_List_Table {
|
||||
break;
|
||||
case 'revoke':
|
||||
printf(
|
||||
'<input type="submit" class="button delete" value="%1$s" aria-label="%2$s">',
|
||||
esc_attr__( 'Revoke' ),
|
||||
'<button type="button" class="button delete" aria-label="%1$s">%2$s</button>',
|
||||
/* translators: %s: the application password's given name. */
|
||||
esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) )
|
||||
esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ),
|
||||
esc_html__( 'Revoke' )
|
||||
);
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -780,7 +780,7 @@ endif;
|
||||
do_action( 'wp_create_application_password_form', $profileuser );
|
||||
?>
|
||||
|
||||
<?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?>
|
||||
<button type="button" name="do_new_application_password" id="do_new_application_password" class="button button-secondary"><?php _e( 'Add New Application Password' ); ?></button>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="notice notice-error inline">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user