From 55aaefe766dcd7954771d05e3e70916f6d051037 Mon Sep 17 00:00:00 2001 From: davidbaumwald Date: Wed, 5 Jan 2022 17:37:03 +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. Built from https://develop.svn.wordpress.org/trunk@52450 git-svn-id: http://core.svn.wordpress.org/trunk@52042 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/user-profile.js | 4 +++- wp-admin/js/user-profile.min.js | 2 +- wp-includes/version.php | 2 +- wp-login.php | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-admin/js/user-profile.js b/wp-admin/js/user-profile.js index 705bf8fb57..b379c0abfa 100644 --- a/wp-admin/js/user-profile.js +++ b/wp-admin/js/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/wp-admin/js/user-profile.min.js b/wp-admin/js/user-profile.min.js index 4f87d89c52..441fa39b85 100644 --- a/wp-admin/js/user-profile.min.js +++ b/wp-admin/js/user-profile.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -!function(o){var e,a,t,n,i,r,d,p,l,c,u=!1,h=wp.i18n.__;function f(){"function"==typeof zxcvbn?(!a.val()||c.hasClass("is-open")?(a.val(a.data("pw")),a.trigger("pwupdate")):g(),b(),1!==parseInt(r.data("start-masked"),10)?a.attr("type","text"):r.trigger("click"),o("#pw-weak-text-label").text(h("Confirm use of weak password")),o(a).trigger("focus")):setTimeout(f,50)}function w(s){r.attr({"aria-label":h(s?"Show password":"Hide password")}).find(".text").text(h(s?"Show":"Hide")).end().find(".dashicons").removeClass(s?"dashicons-hidden":"dashicons-visibility").addClass(s?"dashicons-visibility":"dashicons-hidden")}function m(s,e,a){var t=o("
");t.addClass("notice inline"),t.addClass("notice-"+(e?"success":"error")),t.text(o(o.parseHTML(a)).text()).wrapInner("

"),s.prop("disabled",e),s.siblings(".notice").remove(),s.before(t)}function v(){var s;e=o(".user-pass1-wrap, .user-pass-wrap, .reset-pass-submit"),o(".user-pass2-wrap").hide(),p=o("#submit, #wp-submit").on("click",function(){u=!1}),d=p.add(" #createusersub"),n=o(".pw-weak"),(i=n.find(".pw-checkbox")).on("change",function(){d.prop("disabled",!i.prop("checked"))}),(a=o("#pass1")).length?(l=a.val(),1===parseInt(a.data("reveal"),10)&&f(),a.on("input pwupdate",function(){a.val()!==l&&(l=a.val(),a.removeClass("short bad good strong"),b())})):a=o("#user_pass"),t=o("#pass2").on("input",function(){0]*>/gi,""),t[s].length&&-1===o.inArray(e,a)&&(a.push(e),o("

'+s.message+"

")}).fail(function(s){e.siblings(".notice").remove(),e.before('

'+s.message+"

")}),s.preventDefault()}),window.generatePassword=f,o(window).on("beforeunload",function(){if(!0===u)return h("Your new password has not been saved.")}),o(function(){o(".reset-pass-submit").length&&o(".reset-pass-submit button.wp-generate-pw").trigger("click")})}(jQuery); \ No newline at end of file +!function(o){var e,a,t,n,i,r,d,p,l,c,u=!1,h=wp.i18n.__;function f(){"function"==typeof zxcvbn?(!a.val()||c.hasClass("is-open")?(a.val(a.data("pw")),a.trigger("pwupdate")):g(),b(),1!==parseInt(r.data("start-masked"),10)?a.attr("type","text"):r.trigger("click"),o("#pw-weak-text-label").text(h("Confirm use of weak password")),o(a).trigger("focus")):setTimeout(f,50)}function w(s){r.attr({"aria-label":h(s?"Show password":"Hide password")}).find(".text").text(h(s?"Show":"Hide")).end().find(".dashicons").removeClass(s?"dashicons-hidden":"dashicons-visibility").addClass(s?"dashicons-visibility":"dashicons-hidden")}function m(s,e,a){var t=o("
");t.addClass("notice inline"),t.addClass("notice-"+(e?"success":"error")),t.text(o(o.parseHTML(a)).text()).wrapInner("

"),s.prop("disabled",e),s.siblings(".notice").remove(),s.before(t)}function v(){var s;e=o(".user-pass1-wrap, .user-pass-wrap, .reset-pass-submit"),o(".user-pass2-wrap").hide(),p=o("#submit, #wp-submit").on("click",function(){u=!1}),d=p.add(" #createusersub"),n=o(".pw-weak"),(i=n.find(".pw-checkbox")).on("change",function(){d.prop("disabled",!i.prop("checked"))}),(a=o("#pass1")).length?(l=a.val(),1===parseInt(a.data("reveal"),10)&&f(),a.on("input pwupdate",function(){a.val()!==l&&(l=a.val(),a.removeClass("short bad good strong"),b())})):a=o("#user_pass"),t=o("#pass2").on("input",function(){0]*>/gi,""),t[s].length&&-1===o.inArray(e,a)&&(a.push(e),o("

'+s.message+"

")}).fail(function(s){e.siblings(".notice").remove(),e.before('

'+s.message+"

")}),s.preventDefault()}),window.generatePassword=f,o(window).on("beforeunload",function(){if(!0===u)return h("Your new password has not been saved.")}),o(function(){o(".reset-pass-submit").length&&o(".reset-pass-submit button.wp-generate-pw").trigger("click")})}(jQuery); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index da08cb9be6..1f95b5def1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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. diff --git a/wp-login.php b/wp-login.php index d05df01692..5975a3d58f 100644 --- a/wp-login.php +++ b/wp-login.php @@ -979,7 +979,7 @@ switch ( $action ) { ?>

- +