angular/angular.js — Issue #698: support binding autofocus
Author: pants
Created: 2011-12-22 16:24:02+00:00
State: open

from [comment in #694](https://github.com/angular/angular.js/issues/694#issuecomment-3223870):

> with regards to autofocus, the html5 spec says that the focus should be placed on the element when it is "inserted into the document" and there is also an additional restriction that says that there can be no more than one element with attribute autofocus in the document.
>
> so autofocus is quite tricky and requires special treatment. can you please create a new issue for this and reference this issue or just quote this comment.

Once use case to support could be "set focus to the first input with invalid value". (Browsers supporting html5 form validation do this already on submit, so this would be for other browsers.) In case there isn't already a way to do this trivially in angular.