Make WordPress Core

Changeset 52450


Ignore:
Timestamp:
01/05/2022 05:35:44 PM (2 years ago)
Author:
davidbaumwald
Message:

Login and Registration: Remove aria-expanded from "Generate Password" button.

During password resets, the 'Generate Password" button has a aria-expanded="true" attribute, but the button itself does not expand or collapse anything. This change adds a skip-aria-expanded class to the button which is referenced in JavaScript to skip updating the aria-expanded attribute on the button itself when clicked.

This change also resets the aria-expanded attribute to false for the parent form after it's submitted.

Props alexstine, johnjamesjacoby, sabernhardt.
Fixes #54538.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/user-profile.js

    r52193 r52450  
    217217
    218218            // Make sure the password fields are shown.
    219             $generateButton.attr( 'aria-expanded', 'true' );
     219            $generateButton.not( '.skip-aria-expanded' ).attr( 'aria-expanded', 'true' );
    220220            $passwordWrapper
    221221                .show()
     
    258258            // Stop an empty password from being submitted as a change.
    259259            $submitButtons.prop( 'disabled', false );
     260
     261            $generateButton.attr( 'aria-expanded', 'false' );
    260262        } );
    261263
  • trunk/src/wp-login.php

    r52435 r52450  
    980980            <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" />
    981981            <p class="submit reset-pass-submit">
    982                 <button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="true"><?php _e( 'Generate Password' ); ?></button>
     982                <button type="button" class="button wp-generate-pw hide-if-no-js skip-aria-expanded"><?php _e( 'Generate Password' ); ?></button>
    983983                <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" />
    984984            </p>
Note: See TracChangeset for help on using the changeset viewer.