Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling HTML5's autofocus #6796

Closed
mgifford opened this issue Jan 24, 2017 · 8 comments
Closed

Disabling HTML5's autofocus #6796

mgifford opened this issue Jan 24, 2017 · 8 comments

Comments

@mgifford
Copy link

mgifford commented Jan 24, 2017

We're looking at a few Drupal issues where users are requesting autoFOCUS as per:
https://www.drupal.org/node/2846131

Can't NVDA make this a configurable option? Can't this simply be ignored by the screen reader if the user prefers?

I'm definitely pushing for this to be an option in the browser too, but don't understand why screen readers can't work with this HTML5 attribute.

@jcsteh
Copy link
Contributor

jcsteh commented Jan 24, 2017 via email

@jcsteh jcsteh changed the title Disabling HTML5's autocomplete Disabling HTML5's autofocus Jan 24, 2017
@jcsteh
Copy link
Contributor

jcsteh commented Jan 25, 2017

Looks like you're actually talking about autofocus, not autocomplete. For future reference, please also include background information as to why you are requesting a feature; use cases, etc.

A screen reader follows the focus set by the application. We can't override that without explicitly forcing focus somewhere else.

Even if we wanted to, I don't think this is a good idea... and if we absolutely had to make it user configurable due to demand, it would definitely be disabled by default. The whole point of autofocus is to bring the user's interaction or attention to a specific part of the page, often for efficiency reasons. For example, when you open a search engine like Google, it makes sense that the thing you generally want to do is search. A user shouldn't assume they're going to land at the top of the page. Furthermore, if a form field gets auto focused, NVDA makes this very clear by indicating that it switched to focus mode.

Having a way to disable this also raises a whole lot of other questions. Should we disable all programmatic focus movement or just on page load... and why? Should we disable scrolling to an anchor specified in a URL... and why or why not?

I'm closing this as wontfix for now. We can always consider it if user demand is sufficiently high.

@mgifford
Copy link
Author

Sorry @jcsteh - that was a multi-tasking fail. I've updated the initial comment to remove the "autocomplete" and make it "autofocus". It is titled correctly, but..... My bad.

You provide some great examples for why autofocus is a good idea in some contexts. We definitely agree that adding autofocus can make a site more user friendly for the vast majority of people. In the Drupal community the module selection page is a good example. If you are an administrator of a site and you go there, the only thing you're going to want to do on that page is search for the module that you want to enable/disable. That goes for the advanced search page as well. There are a bunch of issues in the queue about this.

We aren't doing that though as we've been told not to by blind users and I believe it validates WCAG Guideline 3.2. Not certain about that.

I don't know if any browser supports this configuration, but I've created bugs in Chrome & Firefox. I do think it should be done by the browser. I just don't know that it should only be done in the browser. After all, NVDA is a user agent too, right?

I totally agree with you that it should be disabled by default (for whoever adds it).

From the W3C):

"Use of the autofocus attribute can reduce usability and accessibility for users. Users of assistive technology can be adversively affected, because its use overrides the default behaviour of assistive technology to display content at the top of a document in the viewport, or announce content from the start of the document. Users with cognitive disabilities can also be disorientated by unexpected focus movement upon page load.

User agents should provide a method for users to disable the autofocus attribute behaviour."

I'd like to be able to add autofocus to select pages in Drupal Core and not be worried about reducing accessibility. Right now because no user agents (that I know of) support disabling autofocus we're at a bit of a loss.

I can see that there will be some complexity, but I'd like to start by keeping things as simple as possible. Let's do this on page load (and just page load) so that we can start implementing <input type="text" id="search" autofocus>.

@fuzzbomb
Copy link

The autofocus warning that @mgifford quoted in the previous comment is a proposed addition for HTML 5.2, so it's not found in the current HTML 5.1 recommendation.

It was proposed in this W3C github issue, which is still currently open: add warning about use of autofocus attribute

@jcsteh
Copy link
Contributor

jcsteh commented Jan 27, 2017 via email

@mgifford
Copy link
Author

This is great info James. Sounds like a we've got a recommendation to use <input type="text" id="search" autofocus> going ahead in contexts where it makes sense in context.

I had assumed that screen readers actually read the DOM and so would be able to look for attributes like "autofocus" and make decisions based on that.

@PratikP1
Copy link

PratikP1 commented Jan 27, 2017 via email

@mgifford
Copy link
Author

Thank @PratikP1 - that is a good way to frame it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants