[wp-trac] [WordPress Trac] #40301: New filter to disable auto-focus on the login screen
WordPress Trac
noreply at wordpress.org
Wed Mar 29 14:35:15 UTC 2017
#40301: New filter to disable auto-focus on the login screen
------------------------------------+-----------------------------
Reporter: afercia | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Login and Registration | Version:
Severity: normal | Keywords: has-screenshots
Focuses: ui, accessibility |
------------------------------------+-----------------------------
On the login screen, `wp_attempt_focus()` tries to auto-focus the login
input fields:
[[Image(https://cldup.com/nwZk5Fa1my.png)]]
By doing so, anything that comes before the input fields (e.g. the logo)
will be "skipped" for keyboard users and screen reader users. While this
may make sense when the login screen is the default one, it can be
confusing when the login screen is customised.
Using filters and actions, plugin authors can heavily customise the login
screen, adding any kind of content before the login default fields
(including additional form fields). In this case, skipping all that
content wouldn't be so ideal.
There are hacky ways to avoid the call to `wp_attempt_focus()`, like
setting again the global `$error` and as far as I see, people are already
doing that (just googled a bit and found some use cases). I'd propose to
just add a more standard way to don't print out the call to
`wp_attempt_focus()`.
Worth noting the auto-focus will still work on other `wp-login.php` views
like, for example, the lost password one. It probably makes sense to still
have auto-focus where the users task is so specific.
It will also still work when there are error messages, because it is
called by `wp_shake_js()`. For example, when entering a wrong password,
I'd say it still makes sense to focus the password field.
In these two cases, I'd avoid any change. The filter should work just on
the initial login screen.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40301>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list