[wp-meta] [Making WordPress.org] #2391: Autofocus on login page
Making WordPress.org
noreply at wordpress.org
Tue Jan 17 02:22:51 UTC 2017
#2391: Autofocus on login page
------------------------------------+------------------
Reporter: szepe.viktor | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Login & Authentication | Resolution:
Keywords: needs-patch |
------------------------------------+------------------
Changes (by SergeyBiryukov):
* keywords: => needs-patch
* component: General => Login & Authentication
Comment:
In WordPress core, `wp-login.php` file has a
[https://core.trac.wordpress.org/browser/tags/4.7.1/src/wp-login.php#L944
wp_attempt_focus()] function to handle this.
On https://login.wordpress.org/, the
[source:sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-
login/login.php?marks=12&rev=4470#L1 login.php] template uses the
[https://core.trac.wordpress.org/browser/tags/4.7.1/src/wp-includes
/general-template.php#L371 wp_login_form()] function, which doesn't have
autofocus functionality. It falls back to regular login form though (which
does have autofocus) in case of an error, e.g. if you enter an empty
username or password.
A quick fix would be to copy `wp_attempt_focus()` to `login.php` template.
It might also be a worthy enhancement for `wp_login_form()` function in
core.
There's also an `autofocus` HTML attribute, but core only uses it in `wp-
admin/includes/theme-install.php`, see [WP21143]. I guess the JS option is
more flexible, because it focuses different fields (`user_login` vs.
`user_pass`), depending on previous input.
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/2391#comment:1>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list