[wp-trac] [WordPress Trac] #63281: Password field has wrongly focus on installations
WordPress Trac
noreply at wordpress.org
Tue Apr 15 10:49:48 UTC 2025
#63281: Password field has wrongly focus on installations
-------------------------------------------+-----------------------------
Reporter: zodiac1978 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upgrade/Install | Version:
Severity: normal | Keywords: needs-patch
Focuses: ui, accessibility, javascript |
-------------------------------------------+-----------------------------
In the last step of an installation you get asked for a title, username
and password, email and visibility (in this order).
But the password field in the middle gets the focus. This is
counterintuitive. The first item of the form should get the focus.
Why does this happen?
There is a JS one-liner which should put the focus on the first element of
the form:
{{{
<script type="text/javascript">
var t = document.getElementById('weblog_title'); if (t){ t.focus(); }
</script>
}}}
But unfortunately the file user-profile.js is called after that and it
contains this code:
{{{
function g() {
"function" != typeof zxcvbn ? setTimeout(g, 50) : (!a.val() ||
h.hasClass("is-open") ? (a.val(a.data("pw")), a.trigger("pwupdate")) :
C(), x(), y(), 1 !== parseInt(r.data("start-masked"), 10) ? a.attr("type",
"text") : r.trigger("click"), o("#pw-weak-text-label").text(v("Confirm use
of weak password")), "mailserver_pass" !== a.prop("id") &&
o(a).trigger("focus"))
}
}}}
The `trigger("focus")` at the end sets the focus on the password field.
One easy fix could be to change the order here:
https://github.com/WordPress/WordPress/blob/master/wp-
admin/install.php#L479-L485
If we put the online fixing the focus below the wp_print_scripts call it
should modify it to the correct first item.
Just one question remains: Why should this not happen on mobile? As there
is a check `! wp_is_mobile()` ...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63281>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list