From 580e57a6e0fd940c68c43540393d435daf4b3fd9 Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Wed, 5 Jan 2022 17:35:44 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@52450 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/admin/user-profile.js | 4 +++- src/wp-login.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/admin/user-profile.js b/src/js/_enqueues/admin/user-profile.js index 705bf8fb57..b379c0abfa 100644 --- a/src/js/_enqueues/admin/user-profile.js +++ b/src/js/_enqueues/admin/user-profile.js @@ -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' ); @@ -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 () { diff --git a/src/wp-login.php b/src/wp-login.php index d05df01692..5975a3d58f 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -979,7 +979,7 @@ switch ( $action ) { ?>

- +