Skip to content

Commit

Permalink
Login and Registration: Remove aria-expanded from "Generate Passwor…
Browse files Browse the repository at this point in the history
…d" 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.
Built from https://develop.svn.wordpress.org/trunk@52450


git-svn-id: http://core.svn.wordpress.org/trunk@52042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
dream-encode committed Jan 5, 2022
1 parent 9f9440a commit 55aaefe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion wp-admin/js/user-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
updateLock = true;

// Make sure the password fields are shown.
$generateButton.attr( 'aria-expanded', 'true' );
$generateButton.not( '.skip-aria-expanded' ).attr( 'aria-expanded', 'true' );
$passwordWrapper
.show()
.addClass( 'is-open' );
Expand Down Expand Up @@ -257,6 +257,8 @@

// Stop an empty password from being submitted as a change.
$submitButtons.prop( 'disabled', false );

$generateButton.attr( 'aria-expanded', 'false' );
} );

$pass1Row.closest( 'form' ).on( 'submit', function () {
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/user-profile.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52449';
$wp_version = '6.0-alpha-52450';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down
2 changes: 1 addition & 1 deletion wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ function wp_login_viewport_meta() {
?>
<input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" />
<p class="submit reset-pass-submit">
<button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="true"><?php _e( 'Generate Password' ); ?></button>
<button type="button" class="button wp-generate-pw hide-if-no-js skip-aria-expanded"><?php _e( 'Generate Password' ); ?></button>
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" />
</p>
</form>
Expand Down

0 comments on commit 55aaefe

Please sign in to comment.