Make WordPress Core


Ignore:
Timestamp:
06/07/2021 11:48:18 PM (5 years ago)
Author:
joedolson
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-application-passwords-list-table.php

    r50931 r51086  
    111111         */
    112112        public function column_revoke( $item ) {
    113                 submit_button(
    114                         __( 'Revoke' ),
    115                         'delete',
    116                         'revoke-application-password-' . $item['uuid'],
    117                         false,
    118                         array(
    119                                 /* translators: %s: the application password's given name. */
    120                                 'aria-label' => sprintf( __( 'Revoke "%s"' ), $item['name'] ),
    121                         )
     113                $name = 'revoke-application-password-' . $item['uuid'];
     114                printf(
     115                        '<button type="button" name="%1$s" id="%1$s" class="button delete" aria-label="%2$s">%3$s</button>',
     116                        esc_attr( $name ),
     117                        /* translators: %s: the application password's given name. */
     118                        esc_attr( sprintf( __( 'Revoke "%s"' ), $item['name'] ) ),
     119                        __( 'Revoke' )
    122120                );
    123121        }
    … …  
    157155                        <?php if ( 'bottom' === $which ) : ?>
    158156                                <div class="alignright">
    159                                         <?php submit_button( __( 'Revoke all application passwords' ), 'delete', 'revoke-all-application-passwords', false ); ?>
     157                                        <button type="button" name="revoke-all-application-passwords" id="revoke-all-application-passwords" class="button delete"><?php _e( 'Revoke all application passwords' ); ?></button>
    160158                                </div>
    161159                        <?php endif; ?>
    … …  
    236234                                case 'revoke':
    237235                                        printf(
    238                                                 '<input type="submit" class="button delete" value="%1$s" aria-label="%2$s">',
    239                                                 esc_attr__( 'Revoke' ),
     236                                                '<button type="button" class="button delete" aria-label="%1$s">%2$s</button>',
    240237                                                /* translators: %s: the application password's given name. */
    241                                                 esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) )
     238                                                esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ),
     239                                                esc_html__( 'Revoke' )
    242240                                        );
    243241                                        break;
Note: See TracChangeset for help on using the changeset viewer.